summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-09-14 19:42:59 +0200
committerGitHub <noreply@github.com>2021-09-14 19:42:59 +0200
commit8d3ced46cfc901eed0da0186acba920d93bc4576 (patch)
tree1dae983e8e2646bca05242f429bdf0a12bd34978
parent272596b80c8f9cb6ddb6e3f893298f20242a9c32 (diff)
downloadpylint-git-8d3ced46cfc901eed0da0186acba920d93bc4576.tar.gz
Fix deprecation warning for AssignAttr in tests (#5006)
* Fix deprecation warning for AssignAttr We should initialize nodes using their constructor Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
-rw-r--r--tests/checkers/unittest_stdlib.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/checkers/unittest_stdlib.py b/tests/checkers/unittest_stdlib.py
index bbd8e044b..5b753d04c 100644
--- a/tests/checkers/unittest_stdlib.py
+++ b/tests/checkers/unittest_stdlib.py
@@ -41,21 +41,18 @@ class TestStdlibChecker(CheckerTestCase):
CHECKER_CLASS = stdlib.StdlibChecker
def test_deprecated_no_qname_on_unexpected_nodes(self) -> None:
- # Test that we don't crash on nodes which don't have
- # a qname method. While this test might seem weird since
- # it uses a transform, it's actually testing a crash that
- # happened in production, but there was no way to retrieve
- # the code for which this occurred (how an AssignAttr
- # got to be the result of a function inference
- # beats me..)
+ """Test that we don't crash on nodes which don't have a qname method.
+
+ While this test might seem weird since it uses a transform, it's actually testing a crash
+ that happened in production, but there was no way to retrieve the code for which this
+ occurred (how an AssignAttr got to be the result of a function inference beats me..)"""
def infer_func(
node: Name, context: Optional[Any] = None
) -> Iterator[
Union[Iterator, Iterator[AssignAttr]]
]: # pylint: disable=unused-argument
- new_node = nodes.AssignAttr()
- new_node.parent = node
+ new_node = nodes.AssignAttr(attrname="alpha", parent=node)
yield new_node
manager = astroid.MANAGER