示例#1
0
    def test_merge_multiple_elements(self):
        lst0 = [1, 2, 3]
        lst1 = [11, 12, 13]
        lst2 = [13]

        set0 = Set(lst0)
        set1 = Set(lst1)
        set2 = Set(lst2)

        self.assertEquals(set0.merge(set1), Set(lst0 + lst1))
        self.assertEquals(set1.merge(set2), set1)
示例#2
0
    def test_diff_multiple_elements(self):
        lst0 = [1, 2, 3]
        lst1 = [11, 12, 13]
        lst2 = [13]
        lst3 = [11, 12]

        set0 = Set(lst0)
        set1 = Set(lst1)
        set2 = Set(lst2)
        set3 = Set(lst3)

        self.assertEquals(set0.diff(set1), set0)
        self.assertEquals(set1.diff(set0), set1)
        self.assertEquals(set1.diff(set2), set3)
        self.assertEquals(set2.diff(set1), Set())
示例#3
0
    def test_eq_not_empty(self):
        set0 = Set([1, 2, 3])
        set1 = Set([1, 2, 3])
        set2 = Set([4, 5, 6])

        self.assertTrue(set0 == set0)
        self.assertTrue(set1 == set1)
        self.assertTrue(set2 == set2)

        self.assertFalse(set0 == Set())
        self.assertFalse(Set() == set0)

        self.assertTrue(set0 == set1)
        self.assertTrue(set1 == set0)

        self.assertFalse(set0 == set2)
        self.assertFalse(set2 == set0)

        self.assertFalse(set1 == set2)
        self.assertFalse(set2 == set1)
示例#4
0
 def test_diff_empty_sets(self):
     self.assertEquals(Set().diff(Set()), Set())
示例#5
0
 def test_merge_empty_sets(self):
     self.assertEquals(Set().merge(Set()), Set())
示例#6
0
 def setUp(self):
     self.set = Set()
示例#7
0
 def test_eq_empty(self):
     self.assertTrue(Set() == Set())