summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMark Byrne <mbyrnepr2@gmail.com>2023-04-19 14:23:08 +0200
committerDaniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>2023-04-19 23:13:42 +0200
commit29407df24dc9c0ccbe6a1734030d19afb4ade051 (patch)
tree00b17a8672103aa0016f8e8565e702d399d0fdae /tests
parentae9ce82ec6afcf98895a5db8a4d57bdcc13ba055 (diff)
downloadastroid-git-29407df24dc9c0ccbe6a1734030d19afb4ade051.tar.gz
Add ``attr.Factory`` to the recognized class attributes for classes decorated with ``attrs``.
Closes pylint-dev/pylint#4341
Diffstat (limited to 'tests')
-rw-r--r--tests/brain/test_attr.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/brain/test_attr.py b/tests/brain/test_attr.py
index 88d78c7a..5185dff0 100644
--- a/tests/brain/test_attr.py
+++ b/tests/brain/test_attr.py
@@ -74,10 +74,16 @@ class AttrsTest(unittest.TestCase):
l = Eggs(d=1)
l.d['answer'] = 42
+
+ @attr.attrs(auto_attribs=True)
+ class Eggs:
+ d: int = attr.Factory(lambda: 3)
+
+ m = Eggs(d=1)
"""
)
- for name in ("f", "g", "h", "i", "j", "k", "l"):
+ for name in ("f", "g", "h", "i", "j", "k", "l", "m"):
should_be_unknown = next(module.getattr(name)[0].infer()).getattr("d")[0]
self.assertIsInstance(should_be_unknown, astroid.Unknown)