diff options
author | Jacob Walls <jacobtylerwalls@gmail.com> | 2023-04-15 15:26:51 -0400 |
---|---|---|
committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2023-04-16 09:40:26 -0400 |
commit | 309ca8dd7b4d0c95cb3cbb25180857f44050b672 (patch) | |
tree | 7311b8e1f75345afdc264c6fa217ce03be79c0ed /tests | |
parent | 85b698466afe12c750842dc2522f2823365d9fbc (diff) | |
download | astroid-git-309ca8dd7b4d0c95cb3cbb25180857f44050b672.tar.gz |
Fix infer_call_result() crash on methods called with_metaclass() (#2118)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_inference.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/test_inference.py b/tests/test_inference.py index ef99e031..86fdbcf4 100644 --- a/tests/test_inference.py +++ b/tests/test_inference.py @@ -4048,6 +4048,11 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase): inferred = next(node.infer()) self.assertRaises(InferenceError, next, inferred.infer_call_result(node)) + def test_infer_call_result_with_metaclass(self) -> None: + node = extract_node("def with_metaclass(meta, *bases): return 42") + inferred = next(node.infer_call_result(caller=node)) + self.assertIsInstance(inferred, nodes.Const) + def test_context_call_for_context_managers(self) -> None: ast_nodes = extract_node( """ |