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

Method test_equality_Set

Lib/test/test_collections.py:1466–1486  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1464 self.assertFalse(s1.isdisjoint(s3))
1465
1466 def test_equality_Set(self):
1467 class MySet(Set):
1468 def __init__(self, itr):
1469 self.contents = itr
1470 def __contains__(self, x):
1471 return x in self.contents
1472 def __iter__(self):
1473 return iter(self.contents)
1474 def __len__(self):
1475 return len([x for x in self.contents])
1476 s1 = MySet((1,))
1477 s2 = MySet((1, 2))
1478 s3 = MySet((3, 4))
1479 s4 = MySet((3, 4))
1480 self.assertTrue(s2 > s1)
1481 self.assertTrue(s1 < s2)
1482 self.assertFalse(s2 <= s1)
1483 self.assertFalse(s2 <= s3)
1484 self.assertFalse(s1 >= s2)
1485 self.assertEqual(s3, s4)
1486 self.assertNotEqual(s2, s3)
1487
1488 def test_arithmetic_Set(self):
1489 class MySet(Set):

Callers

nothing calls this directly

Calls 5

assertTrueMethod · 0.80
assertFalseMethod · 0.80
assertNotEqualMethod · 0.80
MySetClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected