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

Method test_total_ordering_le

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

Source from the content-addressed store, hash-verified

1282 self.assertFalse(A(1) > A(2))
1283
1284 def test_total_ordering_le(self):
1285 @functools.total_ordering
1286 class A:
1287 def __init__(self, value):
1288 self.value = value
1289 def __le__(self, other):
1290 return self.value <= other.value
1291 def __eq__(self, other):
1292 return self.value == other.value
1293 self.assertTrue(A(1) < A(2))
1294 self.assertTrue(A(2) > A(1))
1295 self.assertTrue(A(1) <= A(2))
1296 self.assertTrue(A(2) >= A(1))
1297 self.assertTrue(A(2) <= A(2))
1298 self.assertTrue(A(2) >= A(2))
1299 self.assertFalse(A(1) >= A(2))
1300
1301 def test_total_ordering_gt(self):
1302 @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