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

Method test_arithmetic_Set

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

Source from the content-addressed store, hash-verified

1486 self.assertNotEqual(s2, s3)
1487
1488 def test_arithmetic_Set(self):
1489 class MySet(Set):
1490 def __init__(self, itr):
1491 self.contents = itr
1492 def __contains__(self, x):
1493 return x in self.contents
1494 def __iter__(self):
1495 return iter(self.contents)
1496 def __len__(self):
1497 return len([x for x in self.contents])
1498 s1 = MySet((1, 2, 3))
1499 s2 = MySet((3, 4, 5))
1500 s3 = s1 & s2
1501 self.assertEqual(s3, MySet((3,)))
1502
1503 def test_MutableSet(self):
1504 self.assertIsInstance(set(), MutableSet)

Callers

nothing calls this directly

Calls 2

MySetClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected