diff options
Diffstat (limited to 'Lib/test/test_defaultdict.py')
-rw-r--r-- | Lib/test/test_defaultdict.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_defaultdict.py b/Lib/test/test_defaultdict.py index 134b5a8..1834f90 100644 --- a/Lib/test/test_defaultdict.py +++ b/Lib/test/test_defaultdict.py @@ -47,6 +47,7 @@ class TestDefaultDict(unittest.TestCase): self.assertEqual(err.args, (15,)) else: self.fail("d2[15] didn't raise KeyError") + self.assertRaises(TypeError, defaultdict, 1) def test_missing(self): d1 = defaultdict() @@ -60,10 +61,10 @@ class TestDefaultDict(unittest.TestCase): self.assertEqual(repr(d1), "defaultdict(None, {})") d1[11] = 41 self.assertEqual(repr(d1), "defaultdict(None, {11: 41})") - d2 = defaultdict(0) - self.assertEqual(d2.default_factory, 0) + d2 = defaultdict(int) + self.assertEqual(d2.default_factory, int) d2[12] = 42 - self.assertEqual(repr(d2), "defaultdict(0, {12: 42})") + self.assertEqual(repr(d2), "defaultdict(<type 'int'>, {12: 42})") def foo(): return 43 d3 = defaultdict(foo) self.assert_(d3.default_factory is foo) |