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

Method test_get_annotations_with_forwardref

Lib/test/test_functools.py:2187–2202  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2185 )
2186
2187 def test_get_annotations_with_forwardref(self):
2188 def orig(a: int) -> nonexistent: ...
2189 lru = self.module.lru_cache(1)(orig)
2190
2191 self.assertEqual(
2192 get_annotations(orig, format=Format.FORWARDREF),
2193 {"a": int, "return": EqualToForwardRef('nonexistent', owner=orig)},
2194 )
2195 self.assertEqual(
2196 get_annotations(lru, format=Format.FORWARDREF),
2197 {"a": int, "return": EqualToForwardRef('nonexistent', owner=lru)},
2198 )
2199 with self.assertRaises(NameError):
2200 get_annotations(orig, format=Format.VALUE)
2201 with self.assertRaises(NameError):
2202 get_annotations(lru, format=Format.VALUE)
2203
2204 @support.skip_on_s390x
2205 @unittest.skipIf(support.is_wasi, "WASI has limited C stack")

Callers

nothing calls this directly

Calls 4

get_annotationsFunction · 0.90
EqualToForwardRefClass · 0.90
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected