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

Method test_getitem

Lib/test/test_annotationlib.py:409–420  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

407 self.assertEqual(interp.format_spec, "")
408
409 def test_getitem(self):
410 def f(x: undef1[str, undef2]):
411 pass
412 anno = get_annotations(f, format=Format.STRING)
413 self.assertEqual(anno, {"x": "undef1[str, undef2]"})
414
415 anno = get_annotations(f, format=Format.FORWARDREF)
416 fwdref = anno["x"]
417 self.assertIsInstance(fwdref, ForwardRef)
418 self.assertEqual(
419 fwdref.evaluate(globals={"undef1": dict, "undef2": float}), dict[str, float]
420 )
421
422 def test_slice(self):
423 def f(x: a[b:c]):

Callers

nothing calls this directly

Calls 4

get_annotationsFunction · 0.90
assertIsInstanceMethod · 0.80
assertEqualMethod · 0.45
evaluateMethod · 0.45

Tested by

no test coverage detected