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

Method test_fwdref_to_builtin

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

Source from the content-addressed store, hash-verified

2134 ForwardRef("Format", module="annotationlib").evaluate(globals={})
2135
2136 def test_fwdref_to_builtin(self):
2137 self.assertIs(ForwardRef("int").evaluate(), int)
2138 self.assertIs(ForwardRef("int", module="collections").evaluate(), int)
2139 self.assertIs(ForwardRef("int", owner=str).evaluate(), int)
2140
2141 # builtins are still searched with explicit globals
2142 self.assertIs(ForwardRef("int").evaluate(globals={}), int)
2143
2144 # explicit values in globals have precedence
2145 obj = object()
2146 self.assertIs(ForwardRef("int").evaluate(globals={"int": obj}), obj)
2147
2148 def test_fwdref_value_is_not_cached(self):
2149 fr = ForwardRef("hello")

Callers

nothing calls this directly

Calls 3

ForwardRefClass · 0.90
assertIsMethod · 0.45
evaluateMethod · 0.45

Tested by

no test coverage detected