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

Method test_total_ordering_ge

Lib/test/test_functools.py:1318–1333  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1316 self.assertFalse(A(2) < A(1))
1317
1318 def test_total_ordering_ge(self):
1319 @functools.total_ordering
1320 class A:
1321 def __init__(self, value):
1322 self.value = value
1323 def __ge__(self, other):
1324 return self.value >= other.value
1325 def __eq__(self, other):
1326 return self.value == other.value
1327 self.assertTrue(A(1) < A(2))
1328 self.assertTrue(A(2) > A(1))
1329 self.assertTrue(A(1) <= A(2))
1330 self.assertTrue(A(2) >= A(1))
1331 self.assertTrue(A(2) <= A(2))
1332 self.assertTrue(A(2) >= A(2))
1333 self.assertFalse(A(2) <= A(1))
1334
1335 def test_total_ordering_no_overwrite(self):
1336 # new methods should not overwrite existing

Callers

nothing calls this directly

Calls 3

assertTrueMethod · 0.80
assertFalseMethod · 0.80
AClass · 0.70

Tested by

no test coverage detected