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

Method test_struct_eq

tests/unit/test_struct.py:1679–1697  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1677 assert hash(p) != hash(Point(1, 2))
1678
1679 def test_struct_eq(self):
1680 class Test(Struct):
1681 a: int
1682 b: int
1683
1684 class Test2(Test):
1685 pass
1686
1687 x = Struct()
1688
1689 self.assert_eq(x, Struct())
1690 self.assert_neq(x, None)
1691
1692 x = Test(1, 2)
1693 self.assert_eq(x, Test(1, 2))
1694 self.assert_neq(x, None)
1695 self.assert_neq(x, Test(1, 3))
1696 self.assert_neq(x, Test(2, 2))
1697 self.assert_neq(x, Test2(1, 2))
1698
1699 def test_struct_override_eq(self):
1700 class Ex(Struct):

Callers

nothing calls this directly

Calls 4

assert_eqMethod · 0.95
assert_neqMethod · 0.95
TestClass · 0.70
Test2Class · 0.70

Tested by

no test coverage detected