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

Method test_index_lookup

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

Source from the content-addressed store, hash-verified

102 fmt.format("{0.lumber}{0.jack}", '')
103
104 def test_index_lookup(self):
105 fmt = string.Formatter()
106 lookup = ["eggs", "and", "spam"]
107 self.assertEqual(fmt.format("{0[2]}{0[0]}", lookup), 'spameggs')
108 with self.assertRaises(IndexError):
109 fmt.format("{0[2]}{0[0]}", [])
110 with self.assertRaises(KeyError):
111 fmt.format("{0[2]}{0[0]}", {})
112
113 def test_auto_numbering_lookup(self):
114 fmt = string.Formatter()

Callers

nothing calls this directly

Calls 3

formatMethod · 0.95
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected