コード例 #1
0
 def test_union(self):
     s1 = HashSet(['J', 'E', 'R', 'I'])
     s2 = HashSet(['H', 'U', 'N', 'T'])
     s3 = s1.union(s2)
     assert s3.contains('J') == True
     assert s3.contains('E') == True
     assert s3.contains('R') == True
     assert s3.contains('I') == True
     assert s3.contains('H') == True
     assert s3.contains('U') == True
     assert s3.contains('N') == True
     assert s3.contains('T') == True
     assert s3.size() == 8
コード例 #2
0
    def test_union(self):
        hs1 = HashSet([1, 2, 3, 4])
        hs2 = HashSet([2, 3, 4, 5])

        union = hs1.union(hs2)
        assert union.items() == [1, 2, 3, 4, 5]