(self)
| 59 | |
| 60 | class TestForwardRefFormat(unittest.TestCase): |
| 61 | def test_closure(self): |
| 62 | def inner(arg: x): |
| 63 | pass |
| 64 | |
| 65 | anno = get_annotations(inner, format=Format.FORWARDREF) |
| 66 | fwdref = anno["arg"] |
| 67 | self.assertIsInstance(fwdref, ForwardRef) |
| 68 | self.assertEqual(fwdref.__forward_arg__, "x") |
| 69 | with self.assertRaises(NameError): |
| 70 | fwdref.evaluate() |
| 71 | |
| 72 | x = 1 |
| 73 | self.assertEqual(fwdref.evaluate(), x) |
| 74 | |
| 75 | anno = get_annotations(inner, format=Format.FORWARDREF) |
| 76 | self.assertEqual(anno["arg"], x) |
| 77 | |
| 78 | def test_multiple_closure(self): |
| 79 | def inner(arg: x[y]): |
nothing calls this directly
no test coverage detected