MCPcopy Index your code
hub / github.com/python/cpython / test_name_fixer

Method test_name_fixer

Lib/test/test_collections.py:457–466  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

455 self.assertEqual(repr(Point.y), "_tuplegetter(1, 'The y-coordinate')")
456
457 def test_name_fixer(self):
458 for spec, renamed in [
459 [('efg', 'g%hi'), ('efg', '_1')], # field with non-alpha char
460 [('abc', 'class'), ('abc', '_1')], # field has keyword
461 [('8efg', '9ghi'), ('_0', '_1')], # field starts with digit
462 [('abc', '_efg'), ('abc', '_1')], # field with leading underscore
463 [('abc', 'efg', 'efg', 'ghi'), ('abc', 'efg', '_2', 'ghi')], # duplicate field
464 [('abc', '', 'x'), ('abc', '_1', 'x')], # fieldname is a space
465 ]:
466 self.assertEqual(namedtuple('NT', spec, rename=True)._fields, renamed)
467
468 def test_module_parameter(self):
469 NT = namedtuple('NT', ['x', 'y'], module=collections)

Callers

nothing calls this directly

Calls 2

namedtupleFunction · 0.90
assertEqualMethod · 0.45

Tested by

no test coverage detected