summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJacob Walls <jacobtylerwalls@gmail.com>2023-04-15 15:26:51 -0400
committerGitHub <noreply@github.com>2023-04-15 21:26:51 +0200
commitee2d4bd07f4d2b9646ba8904ad6337d474c66fa6 (patch)
tree12e8ce58a19666a0a6786b63414d15ac5a9d6324 /tests
parent495581f0ff1b0513397b9177c62f27e702e11bb2 (diff)
downloadastroid-git-ee2d4bd07f4d2b9646ba8904ad6337d474c66fa6.tar.gz
Fix infer_call_result() crash on methods called with_metaclass() (#2118)
Diffstat (limited to 'tests')
-rw-r--r--tests/test_inference.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/test_inference.py b/tests/test_inference.py
index 37a48f08..7fcbb10c 100644
--- a/tests/test_inference.py
+++ b/tests/test_inference.py
@@ -4055,6 +4055,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(
"""