diff options
author | hippo91 <guillaume.peillex@gmail.com> | 2021-02-11 19:11:14 +0100 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-02-12 08:26:52 +0100 |
commit | 6189473d344dbffd72ff65d7bb7fd04351caedaf (patch) | |
tree | df0da16684cad93bfd151d7f4022da5479376289 | |
parent | dc560d470b3351cfc886f62688ee86dcbbb1a3cd (diff) | |
download | astroid-git-6189473d344dbffd72ff65d7bb7fd04351caedaf.tar.gz |
Move the unit test to unittest_brain because it needs six
-rw-r--r-- | tests/unittest_brain.py | 28 | ||||
-rw-r--r-- | tests/unittest_inference.py | 28 |
2 files changed, 28 insertions, 28 deletions
diff --git a/tests/unittest_brain.py b/tests/unittest_brain.py index 45289550..d048066c 100644 --- a/tests/unittest_brain.py +++ b/tests/unittest_brain.py @@ -484,6 +484,34 @@ class SixBrainTest(unittest.TestCase): inferred = next(ast_node.infer()) self.assertIsInstance(inferred, nodes.FunctionDef) + def test_with_metaclass_subclasses_inheritance(self): + ast_node = builder.extract_node( + """ + class A(type): + def test(cls): + return cls + + class C: + pass + + import six + class B(six.with_metaclass(A, C)): + pass + + B #@ + """ + ) + inferred = next(ast_node.infer()) + self.assertIsInstance(inferred, nodes.ClassDef) + self.assertEqual(inferred.name, "B") + bases = inferred.bases + self.assertIsInstance(bases[0], nodes.Call) + ancestors = tuple(inferred.ancestors()) + self.assertIsInstance(ancestors[0], nodes.ClassDef) + self.assertEqual(ancestors[0].name, "C") + self.assertIsInstance(ancestors[1], nodes.ClassDef) + self.assertEqual(ancestors[1].name, "object") + @unittest.skipUnless( HAS_MULTIPROCESSING, diff --git a/tests/unittest_inference.py b/tests/unittest_inference.py index 10dd49d7..c107eadb 100644 --- a/tests/unittest_inference.py +++ b/tests/unittest_inference.py @@ -3793,34 +3793,6 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase): self.assertIsInstance(inferred, nodes.ClassDef) self.assertEqual(inferred.name, "B") - def test_With_metaclass_subclasses_inheritance(self): - ast_node = extract_node( - """ - class A(type): - def test(cls): - return cls - - class C: - pass - - import six - class B(six.with_metaclass(A, C)): - pass - - B #@ - """ - ) - inferred = next(ast_node.infer()) - self.assertIsInstance(inferred, nodes.ClassDef) - self.assertEqual(inferred.name, "B") - bases = inferred.bases - self.assertIsInstance(bases[0], nodes.Call) - ancestors = tuple(inferred.ancestors()) - self.assertIsInstance(ancestors[0], nodes.ClassDef) - self.assertEqual(ancestors[0].name, "C") - self.assertIsInstance(ancestors[1], nodes.ClassDef) - self.assertEqual(ancestors[1].name, "object") - def test_With_metaclass_with_partial_imported_name(self): ast_node = extract_node( """ |