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

Method test_fwdref_with_module

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

Source from the content-addressed store, hash-verified

2120 )
2121
2122 def test_fwdref_with_module(self):
2123 self.assertIs(ForwardRef("Format", module="annotationlib").evaluate(), Format)
2124 self.assertIs(
2125 ForwardRef("Counter", module="collections").evaluate(), collections.Counter
2126 )
2127 self.assertEqual(
2128 ForwardRef("Counter[int]", module="collections").evaluate(),
2129 collections.Counter[int],
2130 )
2131
2132 with self.assertRaises(NameError):
2133 # If globals are passed explicitly, we don't look at the module dict
2134 ForwardRef("Format", module="annotationlib").evaluate(globals={})
2135
2136 def test_fwdref_to_builtin(self):
2137 self.assertIs(ForwardRef("int").evaluate(), int)

Callers

nothing calls this directly

Calls 5

ForwardRefClass · 0.90
assertIsMethod · 0.45
evaluateMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected