Пример #1
0
 def test_is_subset(self):
     first_set = Sets([1, 2, 3, 4, 5, 6])
     second_set = Sets([1, 2, 3, 4])
     assert first_set.is_subset(second_set) == True
     third_set = Sets([11, 12, 13, 14])
     assert first_set.is_subset(third_set) == False
     fourth_set = Sets([2, 2, 2, 2])
     assert first_set.is_subset(fourth_set) == True
     fifth_set = Sets([4, 5, 6, 7, 8])
     assert first_set.is_subset(fifth_set) == False
Пример #2
0
    def test_is_subSets(self):
        set1 = Sets(['A', 'B', 'C'])
        set2 = Sets(['A', 'B'])
        is_a_subset = set1.is_subset(set2)
        assert is_a_subset == True

        set1 = Sets(['A', 'B', 'C', 'D'])
        set2 = Sets(['A', 'B', 'C', 'D', 'E'])
        is_a_subset = set1.is_subset(set2)
        assert is_a_subset == False
Пример #3
0
    def test_is_subset(self):
        set_A = Sets()
        set_B = Sets()

        set_A.add('Ronaldo')
        set_A.add('Mbappe')
        set_A.add('Neymar')
        set_A.add('Messi')

        set_B.add('Mbappe')
        set_B.add('Neymar')

        is_subset_result = set_A.is_subset(set_B)
        assert type(is_subset_result) == bool  # should return a list
        assert set_A.size == 4  # set A should retain its original size
        assert set_B.size == 2  # set B should retain its original size
        assert set_B.is_subset(
            set_A) == True  # SET B's elements are all in SET A

        set_B.add('Pele')  # Added an element in SET B that is not in set A
        assert set_B.is_subset(
            set_A) == False  #  SET B's elements are not all in SET A