diff options
author | Raymond Hettinger <python@rcn.com> | 2009-04-02 22:25:40 +0000 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-04-02 22:25:40 +0000 |
commit | 756ab67a9867cd158aa63d9ac5ce99809e0a2175 (patch) | |
tree | 335fbc440020f794de4d8b10108d3f0d3e3356f6 /Lib/test/test_collections.py | |
parent | 789be0c0a0656d17f831aa781cf7c5d55e5b4835 (diff) | |
download | cpython-git-756ab67a9867cd158aa63d9ac5ce99809e0a2175.tar.gz |
Have namedtuple's field renamer assign names that
are consistent with the corresponding tuple index.
Diffstat (limited to 'Lib/test/test_collections.py')
-rw-r--r-- | Lib/test/test_collections.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index 8ffa75bdc5..f822b6b482 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -49,12 +49,12 @@ class TestNamedTuple(unittest.TestCase): def test_name_fixer(self): for spec, renamed in [ - [('efg', 'g%hi'), ('efg', '_2')], # field with non-alpha char - [('abc', 'class'), ('abc', '_2')], # field has keyword - [('8efg', '9ghi'), ('_1', '_2')], # field starts with digit - [('abc', '_efg'), ('abc', '_2')], # field with leading underscore - [('abc', 'efg', 'efg', 'ghi'), ('abc', 'efg', '_3', 'ghi')], # duplicate field - [('abc', '', 'x'), ('abc', '_2', 'x')], # fieldname is a space + [('efg', 'g%hi'), ('efg', '_1')], # field with non-alpha char + [('abc', 'class'), ('abc', '_1')], # field has keyword + [('8efg', '9ghi'), ('_0', '_1')], # field starts with digit + [('abc', '_efg'), ('abc', '_1')], # field with leading underscore + [('abc', 'efg', 'efg', 'ghi'), ('abc', 'efg', '_2', 'ghi')], # duplicate field + [('abc', '', 'x'), ('abc', '_1', 'x')], # fieldname is a space ]: self.assertEqual(namedtuple('NT', spec, rename=True)._fields, renamed) |