Esempio n. 1
0
    def test4(self):
        L = DictSet(s2d('a1 c5666788'))

        with self.assertRaises(TypeError) as cm:
            L.add('d', [])

        self.assertEqual(str(cm.exception), "unhashable type: 'list'")
Esempio n. 2
0
    def test7(self):
        L = DictSet(s2d('a123 b456 c0'))
        R = s2l('a123 b456 c0')
        L.add('c')  # shouldn't do anything

        self.assertEqual(d2l(L), R)
Esempio n. 3
0
    def test6(self):
        L = DictSet(s2d('b456'))
        R = s2l('b456 c0')
        L.add('c')

        self.assertEqual(d2l(L), R)
Esempio n. 4
0
    def test5(self):
        L = DictSet(s2d('b456'))
        R = s2l('b456')
        L.add('b')

        self.assertEqual(d2l(L), R)  # b should stay unaltered
Esempio n. 5
0
    def test3(self):
        L = DictSet(s2d('a1 c5666788'))
        R = s2l('a1 c56  78  d7')
        L.add('d', '7')  # create new set

        self.assertEqual(d2l(L), R)
Esempio n. 6
0
    def test1(self):
        L = DictSet(s2d('a1 c5666788'))
        R = s2l('a1 c56  78')
        L.add('c', '7')  # does nothing to existing set

        self.assertEqual(d2l(L), R)
Esempio n. 7
0
    def test0(self):
        L = DictSet(s2d('a1 c5666788'))
        R = s2l('a1 c56  78 9')
        L.add('c', '9')  # add to existing set

        self.assertEqual(d2l(L), R)