def test_intersection(self): first_set = HashSet(['One', 'Two', 'Three', 'Four']) second_set = HashSet(['Red', 'Two', 'Three', 'Orange']) intersection = first_set.intersection(second_set) assert intersection.size == 2 assert intersection.contains('Two') assert intersection.contains('Three')
def test_intersection(self): data_a = ['A', 'B', 'C', 'D'] hs_a = HashSet(data_a) data_b = ['C', 'D', 'E', 'F'] hs_b = HashSet(data_b) intersection_hs = hs_a.intersection(hs_b) assert intersection_hs.contains('C') == True assert intersection_hs.contains('D') == True
def test_intersection(self): set_one = [0, 1, 2, 3, 4, 5] set_two = [3, 4, 5, 6, 7, 8] hs_one = HashSet(set_one) hs_two = HashSet(set_two) assert hs_one.size() == 6 assert hs_two.size() == 6 assert hs_one.intersection(hs_two).size() == 3
def test_intersection(self): hs = HashSet(['one', 'fish', 'two', 'fish']) hs2 = HashSet(['red', 'fish', 'blue', 'fish', 'two']) hs_intersect = hs.intersection(hs2) assert hs_intersect.contains('fish') is True assert hs_intersect.contains('two') is True print(str(hs_intersect)) assert hs_intersect.contains('one') is False assert hs_intersect.contains('red') is False assert hs_intersect.contains('blue') is False
def test_intersection(self): """Check if the intersection operation works as intended.""" hashset = HashSet() hashset.add('Hash') hashset.add('Set') other_hashset = HashSet() other_hashset.add('Linked') other_hashset.add('Set') intersection = hashset.intersection(other_hashset) assert intersection.size == 1 assert intersection.contains('Hash') is False assert intersection.contains('Set') is True assert intersection.contains('Linked') is False
def test_intersection(self): elements1 = ["1", "2", "5", "9"] elements2 = ["9", "2", "4", "3"] hs = HashSet(elements1) other_hs = HashSet(elements2) intersection = hs.intersection(other_hs) assert intersection.contains("9") == True assert intersection.contains("2") == True assert intersection.contains("1") == False assert intersection.contains("5") == False assert intersection.contains("4") == False assert intersection.contains("3") == False
def test_intersection(self): set_a = HashSet([1, 2, 3]) set_b = HashSet([4, 2, 3]) assert set_a.intersection(set_b).elements() == [2, 3] set_c = HashSet([1]) assert set_a.intersection(set_c).elements() == [1]