def test_is_subset(self):
        # two sets with one common element
        set = HashSet(
            ['Talent code', 'Outliers', 'Talking to strangers', 'Idea man'])
        other_set = HashSet(
            ['Beloved', 'Nightingale', 'Mistress of the game', 'Idea man'])

        assert set.is_subset(
            other_set) is False  #all the ele in set are not in other_set
        # therefore expecting false

        # two sets with no common ele
        set = HashSet(
            ['Talent code', 'Outliers', 'Talking to strangers', 'Capital'])
        other_set = HashSet(
            ['Beloved', 'Nightingale', 'Mistress of the game', 'Idea man'])

        assert set.is_subset(other_set) is False

        # two sets with the same element
        set = HashSet(
            ['Talent code', 'Outliers', 'Talking to strangers', 'Capital'])
        other_set = HashSet(
            ['Talent code', 'Outliers', 'Talking to strangers', 'Capital'])

        assert set.is_subset(other_set) is True
Beispiel #2
0
	def test_is_subset(self):

		set_one = HashSet(["A", "B", "C"])
		set_two = HashSet(["C", "D", "E"])

		assert set_one.is_subset(set_two) == False
		assert set_one.is_subset(HashSet(["A", "B", "C"])) == True
		assert set_one.is_subset(HashSet(["A", "B", "C", "D"])) == True
Beispiel #3
0
 def test_is_subset(self):
     elements = ['Y', 'C', 'D']
     elements2 = ['C', 'G', 'U', 'D', 'T', 'Y']
     elements3 = ['P', 'H', 'Y', 'D', 'E', 'F']
     set = HashSet(elements)
     set2 = HashSet(elements2)
     set3 = HashSet(elements3)
     assert set.is_subset(set2) is True
     assert set.is_subset(set3) is False
     assert set2.is_subset(set3) is False
 def test_is_subset(self):
     elements = ['A', 'G', 'R']
     elements2 = ['G', 'D', 'R', 'P', 'A', 'W']
     elements3 = ['I', 'O', 'S', 'K', 'M', 'Z']
     set1 = HashSet(elements)
     set2 = HashSet(elements2)
     set3 = HashSet(elements3)
     assert set1.is_subset(set2) is True
     assert set1.is_subset(set3) is False
     assert set2.is_subset(set3) is False