summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarc Mueller <30130371+cdce8p@users.noreply.github.com>2022-10-17 09:17:40 +0200
committerGitHub <noreply@github.com>2022-10-17 09:17:40 +0200
commit85fe271902c8e7c11e05bc88c062142b0e6f0e2b (patch)
treee9b9c0843d43d276d086e214a994c00feb48472a /tests
parent05b8e8baec9f81463f6fba7df286ddcadab614aa (diff)
downloadastroid-git-85fe271902c8e7c11e05bc88c062142b0e6f0e2b.tar.gz
Fix detecting invalid metaclasses (#1836)
Regression from #1678
Diffstat (limited to 'tests')
-rw-r--r--tests/unittest_scoped_nodes.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unittest_scoped_nodes.py b/tests/unittest_scoped_nodes.py
index 9e33de6e..2db193cc 100644
--- a/tests/unittest_scoped_nodes.py
+++ b/tests/unittest_scoped_nodes.py
@@ -1415,6 +1415,20 @@ class ClassNodeTest(ModuleLoader, unittest.TestCase):
inferred = next(klass.infer())
self.assertIsNone(inferred.metaclass())
+ @staticmethod
+ def test_with_invalid_metaclass():
+ klass = extract_node(
+ """
+ class InvalidAsMetaclass: ...
+
+ class Invalid(metaclass=InvalidAsMetaclass()): #@
+ pass
+ """
+ )
+ inferred = next(klass.infer())
+ metaclass = inferred.metaclass()
+ assert isinstance(metaclass, Instance)
+
def test_nonregr_infer_callresult(self) -> None:
astroid = builder.parse(
"""