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

Method test_total_ordering_lt

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

Source from the content-addressed store, hash-verified

1265class TestTotalOrdering(unittest.TestCase):
1266
1267 def test_total_ordering_lt(self):
1268 @functools.total_ordering
1269 class A:
1270 def __init__(self, value):
1271 self.value = value
1272 def __lt__(self, other):
1273 return self.value < other.value
1274 def __eq__(self, other):
1275 return self.value == other.value
1276 self.assertTrue(A(1) < A(2))
1277 self.assertTrue(A(2) > A(1))
1278 self.assertTrue(A(1) <= A(2))
1279 self.assertTrue(A(2) >= A(1))
1280 self.assertTrue(A(2) <= A(2))
1281 self.assertTrue(A(2) >= A(2))
1282 self.assertFalse(A(1) > A(2))
1283
1284 def test_total_ordering_le(self):
1285 @functools.total_ordering

Callers

nothing calls this directly

Calls 3

assertTrueMethod · 0.80
assertFalseMethod · 0.80
AClass · 0.70

Tested by

no test coverage detected