From 29407df24dc9c0ccbe6a1734030d19afb4ade051 Mon Sep 17 00:00:00 2001 From: Mark Byrne Date: Wed, 19 Apr 2023 14:23:08 +0200 Subject: Add ``attr.Factory`` to the recognized class attributes for classes decorated with ``attrs``. Closes pylint-dev/pylint#4341 --- tests/brain/test_attr.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests') 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) -- cgit v1.2.1