Ejemplo n.º 1
0
    def test_has_key(self):
        d = CuteSleekValueDict(null_callback)
        self.assertFalse(d.has_key('a'))
        d = CuteSleekValueDict(null_callback, {'a': 1, 'b': 2})
        k = d.keys()
        k.sort()
        self.assertEqual(k, ['a', 'b'])

        self.assertRaises(TypeError, d.has_key)
Ejemplo n.º 2
0
    def test_keys(self):
        d = CuteSleekValueDict(null_callback)
        self.assertEqual(d.keys(), [])
        d = CuteSleekValueDict(null_callback, {'a': 1, 'b': 2})
        k = d.keys()
        self.assertTrue(d.has_key('a'))
        self.assertTrue(d.has_key('b'))

        self.assertRaises(TypeError, d.keys, None)