diff options
| author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2022-07-03 18:15:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-03 18:15:51 +0200 |
| commit | a6fdf0b92af0190dfc8334a69548919cc7130204 (patch) | |
| tree | c33a18d2a6708573c974741d132cfb5804d7e667 /tests | |
| parent | dd80a68fc93d507c3a8182ea5b94f6cbe0e348a7 (diff) | |
| download | astroid-git-a6fdf0b92af0190dfc8334a69548919cc7130204.tar.gz | |
Add ``__new__`` and ``__call__`` to``ObjectModel`` and ``ClassModel`` (#1606)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unittest_objects.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unittest_objects.py b/tests/unittest_objects.py index 1b8f3119..ff6963b2 100644 --- a/tests/unittest_objects.py +++ b/tests/unittest_objects.py @@ -32,6 +32,24 @@ class ObjectsTest(unittest.TestCase): self.assertEqual(inferred.qname(), "builtins.frozenset") self.assertIsInstance(proxied, nodes.ClassDef) + def test_lookup_regression_slots(self) -> None: + """Regression test for attr__new__ of ObjectModel. + + ObjectModel._instance is not always an bases.Instance, so we can't + rely on the ._proxied attribute of an Instance. + """ + + node = builder.extract_node( + """ + class ClassHavingUnknownAncestors(Unknown): + __slots__ = ["yo"] + + def test(self): + self.not_yo = 42 + """ + ) + assert node.getattr("__new__") + class SuperTests(unittest.TestCase): def test_inferring_super_outside_methods(self) -> None: |
