diff options
| author | Raymond Hettinger <python@rcn.com> | 2007-10-05 02:47:07 (GMT) |
|---|---|---|
| committer | Raymond Hettinger <python@rcn.com> | 2007-10-05 02:47:07 (GMT) |
| commit | a7fc4b13e08430b14b2ac18555ba4dda315948d0 (patch) | |
| tree | 36d96ea5ac95c1e83b5ad0ce56b31134a69673a4 /Lib/test/test_collections.py | |
| parent | c9b7163da511684c49f53fef7b9a49eb44fff5e8 (diff) | |
| download | cpython-a7fc4b13e08430b14b2ac18555ba4dda315948d0.zip cpython-a7fc4b13e08430b14b2ac18555ba4dda315948d0.tar.gz cpython-a7fc4b13e08430b14b2ac18555ba4dda315948d0.tar.bz2 | |
Add __asdict__() to NamedTuple and refine the docs.
Add maxlen support to deque() and fixup docs.
Partially fix __reduce__(). The None as a third arg was no longer supported.
Still needs work on __reduce__() to handle recursive inputs.
Diffstat (limited to 'Lib/test/test_collections.py')
| -rw-r--r-- | Lib/test/test_collections.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index ab36ad8..939c3ce 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -13,6 +13,7 @@ class TestNamedTuple(unittest.TestCase): self.assertEqual(Point.__getitem__, tuple.__getitem__) self.assertRaises(ValueError, NamedTuple, 'abc%', 'def ghi') self.assertRaises(ValueError, NamedTuple, 'abc', 'def g%hi') + self.assertRaises(ValueError, NamedTuple, 'abc', '__def__ ghi') NamedTuple('Point0', 'x1 y2') # Verify that numbers are allowed in names def test_instance(self): @@ -32,6 +33,7 @@ class TestNamedTuple(unittest.TestCase): self.assert_('__weakref__' not in dir(p)) self.assertEqual(p.__fields__, ('x', 'y')) # test __fields__ attribute self.assertEqual(p.__replace__('x', 1), (1, 22)) # test __replace__ method + self.assertEqual(p.__asdict__(), dict(x=11, y=22)) # test __dict__ method # verify that field string can have commas Point = NamedTuple('Point', 'x, y') |
