(self)
| 76 | self.assertEqual(anno["arg"], x) |
| 77 | |
| 78 | def test_multiple_closure(self): |
| 79 | def inner(arg: x[y]): |
| 80 | pass |
| 81 | |
| 82 | fwdref = get_annotations(inner, format=Format.FORWARDREF)["arg"] |
| 83 | self.assertIsInstance(fwdref, ForwardRef) |
| 84 | self.assertEqual(fwdref.__forward_arg__, "x[y]") |
| 85 | with self.assertRaises(NameError): |
| 86 | fwdref.evaluate() |
| 87 | |
| 88 | y = str |
| 89 | fwdref = get_annotations(inner, format=Format.FORWARDREF)["arg"] |
| 90 | self.assertIsInstance(fwdref, ForwardRef) |
| 91 | extra_name, extra_val = next(iter(fwdref.__extra_names__.items())) |
| 92 | self.assertEqual(fwdref.__forward_arg__.replace(extra_name, extra_val.__name__), "x[str]") |
| 93 | with self.assertRaises(NameError): |
| 94 | fwdref.evaluate() |
| 95 | |
| 96 | x = list |
| 97 | self.assertEqual(fwdref.evaluate(), x[y]) |
| 98 | |
| 99 | fwdref = get_annotations(inner, format=Format.FORWARDREF)["arg"] |
| 100 | self.assertEqual(fwdref, x[y]) |
| 101 | |
| 102 | def test_function(self): |
| 103 | def f(x: int, y: doesntexist): |
nothing calls this directly
no test coverage detected