diff options
author | Raymond Hettinger <python@rcn.com> | 2009-04-02 22:31:59 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-04-02 22:31:59 (GMT) |
commit | 56145242930f98cbb1553888566d30a98158bfc8 (patch) | |
tree | 977bef7779f6036cbbcb7cff6b1e7e0aed5d8693 /Lib/test/test_collections.py | |
parent | c26d43966d8d54fc90b254b60bed2f33f693c155 (diff) | |
download | cpython-56145242930f98cbb1553888566d30a98158bfc8.zip cpython-56145242930f98cbb1553888566d30a98158bfc8.tar.gz cpython-56145242930f98cbb1553888566d30a98158bfc8.tar.bz2 |
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 e8d72ee..c471361 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -51,12 +51,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) |