diff options
Diffstat (limited to 'Lib/test/test_collections.py')
-rw-r--r-- | Lib/test/test_collections.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index f5dad7d223..94015b42d3 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -30,6 +30,13 @@ class TestNamedTuple(unittest.TestCase): self.assertEqual(repr(p), 'Point(x=11, y=22)') self.assert_('__dict__' not in dir(p)) # verify instance has no dict 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 + + # verify that field string can have commas + Point = NamedTuple('Point', 'x, y') + p = Point(x=11, y=22) + self.assertEqual(repr(p), 'Point(x=11, y=22)') def test_tupleness(self): Point = NamedTuple('Point', 'x y') |