MCPcopy Index your code
hub / github.com/python/cpython / test_not_tuple

Method test_not_tuple

Lib/test/test_dataclasses/__init__.py:814–827  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

812 self.assertEqual(C(42).x, 42)
813
814 def test_not_tuple(self):
815 # Make sure we can't be compared to a tuple.
816 @dataclass
817 class Point:
818 x: int
819 y: int
820 self.assertNotEqual(Point(1, 2), (1, 2))
821
822 # And that we can't compare to another unrelated dataclass.
823 @dataclass
824 class C:
825 x: int
826 y: int
827 self.assertNotEqual(Point(1, 3), C(1, 3))
828
829 def test_not_other_dataclass(self):
830 # Test that some of the problems with namedtuple don't happen

Callers

nothing calls this directly

Calls 3

assertNotEqualMethod · 0.95
PointClass · 0.70
CClass · 0.70

Tested by

no test coverage detected