MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_name_fixer

Method test_name_fixer

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

Source from the content-addressed store, hash-verified

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