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

Method test_patma_177

Lib/test/test_patma.py:1823–1844  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1821 self.assertEqual(whereis(42), "Not a point")
1822
1823 def test_patma_177(self):
1824 def whereis(point):
1825 match point:
1826 case Point(0, 0):
1827 return "Origin"
1828 case Point(0, y):
1829 return f"Y={y}"
1830 case Point(x, 0):
1831 return f"X={x}"
1832 case Point():
1833 return "Somewhere else"
1834 case _:
1835 return "Not a point"
1836 self.assertEqual(whereis(Point(1, 0)), "X=1")
1837 self.assertEqual(whereis(Point(0, 0)), "Origin")
1838 self.assertEqual(whereis(10), "Not a point")
1839 self.assertEqual(whereis(Point(False, False)), "Origin")
1840 self.assertEqual(whereis(Point(0, -1.0)), "Y=-1.0")
1841 self.assertEqual(whereis(Point("X", 0)), "X=X")
1842 self.assertEqual(whereis(Point(None, 1j)), "Somewhere else")
1843 self.assertEqual(whereis(Point), "Not a point")
1844 self.assertEqual(whereis(42), "Not a point")
1845
1846 def test_patma_178(self):
1847 def whereis(point):

Callers

nothing calls this directly

Calls 2

PointClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected