diff options
| author | Tim Martin <tim@asymptotic.co.uk> | 2020-10-07 18:44:48 +0100 |
|---|---|---|
| committer | Tim Martin <tim@asymptotic.co.uk> | 2020-10-13 19:55:36 +0100 |
| commit | 7f1d5134d89aab9b3e49030676637debfd731dbb (patch) | |
| tree | 2bbc50a1bbc1896de3ff3fe4f6f46bcf78bad8be /tests | |
| parent | 1d14e985baf8847be60b81b7f6140e8606fd862a (diff) | |
| download | astroid-git-7f1d5134d89aab9b3e49030676637debfd731dbb.tar.gz | |
Fix incorrect MRO being calculated for scoped multiple inheritance
If a class inherits from two bases and the classes are expressed as a
non-trivial expression such as qualified with a module name, classes
after the first could not be inferred due to reusing the context
object in _inferred_bases
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unittest_scoped_nodes.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/unittest_scoped_nodes.py b/tests/unittest_scoped_nodes.py index c4597fa6..2606fd47 100644 --- a/tests/unittest_scoped_nodes.py +++ b/tests/unittest_scoped_nodes.py @@ -1417,6 +1417,30 @@ class ClassNodeTest(ModuleLoader, unittest.TestCase): ], ) + def test_mro_with_attribute_classes(self): + cls = builder.extract_node( + """ + class A: + pass + class B: + pass + scope = object() + scope.A = A + scope.B = B + class C(scope.A, scope.B): + pass + """ + ) + self.assertEqualMro( + cls, + [ + "C", + "A", + "B", + "object" + ] + ) + def test_generator_from_infer_call_result_parent(self): func = builder.extract_node( """ |
