def test_difference(self): elements = ['4', '7', '8', '9', '0'] elements2 = ['4', '5', '6', '10', '8', '9'] elements3 = ['1', '3', '5', '7', '0'] set = TreeSet(elements) set2 = TreeSet(elements2) set3 = TreeSet(elements3) self.assertCountEqual( set.difference(set2).tree.items_in_order(), ['7', '0']) self.assertCountEqual( set.difference(set3).tree.items_in_order(), ['4', '8', '9'])
def test_difference(self): s1 = TreeSet(['A', 'B', 'D']) s2 = TreeSet(['A', 'B', 'C']) difference_set = s2.difference(s1) assert difference_set.size == 2 assert difference_set.contains('D') assert difference_set.contains('C')
def test_difference(self): """Testing the difference method""" set_one = TreeSet(['C', 'B', 'A', 'E', 'D']) set_two = TreeSet(['G', 'F', 'E', 'I', 'H']) difference = set_one.difference(set_two) assert repr(difference) == "('A'), ('B'), ('C'), ('D')" assert difference.contains('A') assert difference.contains('C') assert not difference.contains('E') assert not difference.contains('G') assert not difference.contains('I') assert difference.size == 4