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

Method test_field_repr

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

Source from the content-addressed store, hash-verified

443
444 @support.cpython_only
445 def test_field_repr(self):
446 Point = namedtuple('Point', 'x y')
447 self.assertEqual(repr(Point.x), "_tuplegetter(0, 'Alias for field number 0')")
448 self.assertEqual(repr(Point.y), "_tuplegetter(1, 'Alias for field number 1')")
449
450 Point.x.__doc__ = 'The x-coordinate'
451 Point.y.__doc__ = 'The y-coordinate'
452
453 self.assertEqual(repr(Point.x), "_tuplegetter(0, 'The x-coordinate')")
454 self.assertEqual(repr(Point.y), "_tuplegetter(1, 'The y-coordinate')")
455
456 def test_name_fixer(self):
457 for spec, renamed in [

Callers

nothing calls this directly

Calls 3

namedtupleFunction · 0.90
reprFunction · 0.85
assertEqualMethod · 0.45

Tested by

no test coverage detected