MCPcopy Index your code
hub / github.com/msgspec/msgspec / test_struct_order

Method test_struct_order

tests/unit/test_struct.py:1727–1741  ·  view source on GitHub ↗
(self, op)

Source from the content-addressed store, hash-verified

1725
1726 @pytest.mark.parametrize("op", ["le", "lt", "ge", "gt"])
1727 def test_struct_order(self, op):
1728 func = getattr(operator, op)
1729
1730 class Point(Struct, order=True):
1731 x: int
1732 y: int
1733
1734 origin = Point(0, 0)
1735 for x in [-1, 0, 1]:
1736 for y in [-1, 0, 1]:
1737 sol = func((0, 0), (x, y))
1738 res = func(origin, Point(x, y))
1739 assert res == sol
1740
1741 assert func(origin, origin) == func(1, 1)
1742
1743 @pytest.mark.parametrize("eq, order", [(False, False), (True, False), (True, True)])
1744 def test_struct_compare_returns_notimplemented(self, eq, order):

Callers

nothing calls this directly

Calls 1

PointClass · 0.70

Tested by

no test coverage detected