summaryrefslogtreecommitdiff
path: root/Lib/test/test_collections.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2007-10-05 02:47:07 +0000
committerRaymond Hettinger <python@rcn.com>2007-10-05 02:47:07 +0000
commita7fc4b13e08430b14b2ac18555ba4dda315948d0 (patch)
tree36d96ea5ac95c1e83b5ad0ce56b31134a69673a4 /Lib/test/test_collections.py
parentc9b7163da511684c49f53fef7b9a49eb44fff5e8 (diff)
downloadcpython-git-a7fc4b13e08430b14b2ac18555ba4dda315948d0.tar.gz
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.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index ab36ad87b7..939c3cebff 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')