diff options
author | Raymond Hettinger <python@rcn.com> | 2011-06-03 06:40:24 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2011-06-03 06:40:24 (GMT) |
commit | 3d89057ff80261e8960420305b432cd9783bb4e2 (patch) | |
tree | 84778cfe5a4fd0db53d202bae6b9c5b1cdcd648b /Lib/test/test_collections.py | |
parent | 9028928156b187eb0d684233960c568b46f11088 (diff) | |
download | cpython-3d89057ff80261e8960420305b432cd9783bb4e2.zip cpython-3d89057ff80261e8960420305b432cd9783bb4e2.tar.gz cpython-3d89057ff80261e8960420305b432cd9783bb4e2.tar.bz2 |
Fix named tuples to work with vars().
Diffstat (limited to 'Lib/test/test_collections.py')
-rw-r--r-- | Lib/test/test_collections.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index 2b7b68b..ccf93c5 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -180,12 +180,12 @@ class TestNamedTuple(unittest.TestCase): self.assertRaises(TypeError, eval, 'Point(XXX=1, y=2)', locals()) # wrong keyword argument self.assertRaises(TypeError, eval, 'Point(x=1)', locals()) # missing keyword argument self.assertEqual(repr(p), 'Point(x=11, y=22)') - self.assertNotIn('__dict__', dir(p)) # verify instance has no dict self.assertNotIn('__weakref__', dir(p)) self.assertEqual(p, Point._make([11, 22])) # test _make classmethod 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 _asdict method + self.assertEqual(vars(p), p._asdict()) # verify that vars() works try: p._replace(x=1, error=2) |