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

Method test_name_lookup

Lib/test/test_string/test_string.py:94–102  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

92 self.assertEqual(fmt.format("{0!a}", chr(256)), "'\\u0100'")
93
94 def test_name_lookup(self):
95 fmt = string.Formatter()
96 class AnyAttr:
97 def __getattr__(self, attr):
98 return attr
99 x = AnyAttr()
100 self.assertEqual(fmt.format("{0.lumber}{0.jack}", x), 'lumberjack')
101 with self.assertRaises(AttributeError):
102 fmt.format("{0.lumber}{0.jack}", '')
103
104 def test_index_lookup(self):
105 fmt = string.Formatter()

Callers

nothing calls this directly

Calls 4

formatMethod · 0.95
AnyAttrClass · 0.85
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected