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

Method test_field_repr

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

namedtupleFunction · 0.90
assertEqualMethod · 0.45

Tested by

no test coverage detected