summaryrefslogtreecommitdiff
path: root/tests/checkers/unittest_variables.py
diff options
context:
space:
mode:
authorDaniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>2021-12-13 23:17:48 +0100
committerGitHub <noreply@github.com>2021-12-13 23:17:48 +0100
commit71bbbdb29407a2b4525f0bf2da8b0025da5fc4d8 (patch)
treeb76887ba7216a30ee99f812bc33142a510a2e7eb /tests/checkers/unittest_variables.py
parent78eed6af303e0e9854e43528d17d2ada96f11c09 (diff)
downloadpylint-git-71bbbdb29407a2b4525f0bf2da8b0025da5fc4d8.tar.gz
Check `node` location attributes in unittests and update tests (#5383)
* Allow checking of `end_col_offset` and `end_lineno` in unittests * Allow checking of `col_offset` in unittests * Allow checking of `lineno` in unittests * Update tests for ``TestVariablesChecker`` * Fix ``TestMultiNamingStyle`` * Update tests for ``TestImportsChecker`` * Add location attributes to messages of ``TestTypeChecker`` * Add location params to ``TestMessage``'s of ``TestDeprecatedChecker`` * Add location params to ``TestMessage``'s of ``TestTypeCheckerOnDecorators`` * Add changelog and ``DeprecationWarning``
Diffstat (limited to 'tests/checkers/unittest_variables.py')
-rw-r--r--tests/checkers/unittest_variables.py28
1 files changed, 25 insertions, 3 deletions
diff --git a/tests/checkers/unittest_variables.py b/tests/checkers/unittest_variables.py
index 43ecedb90..a59278bb9 100644
--- a/tests/checkers/unittest_variables.py
+++ b/tests/checkers/unittest_variables.py
@@ -90,7 +90,14 @@ class TestVariablesCheckerWithTearDown(CheckerTestCase):
)
with self.assertAddsMessages(
MessageTest(
- "unused-argument", node=node["abc"], args="abc", confidence=HIGH
+ "unused-argument",
+ node=node["abc"],
+ args="abc",
+ confidence=HIGH,
+ line=2,
+ col_offset=16,
+ end_line=2,
+ end_col_offset=19,
)
):
self.checker.visit_functiondef(node)
@@ -104,7 +111,14 @@ class TestVariablesCheckerWithTearDown(CheckerTestCase):
)
with self.assertAddsMessages(
MessageTest(
- "unused-argument", node=node["abc"], args="abc", confidence=HIGH
+ "unused-argument",
+ node=node["abc"],
+ args="abc",
+ confidence=HIGH,
+ line=2,
+ col_offset=12,
+ end_line=2,
+ end_col_offset=15,
)
):
self.checker.visit_functiondef(node)
@@ -118,7 +132,15 @@ class TestVariablesCheckerWithTearDown(CheckerTestCase):
"""
)
with self.assertAddsMessages(
- MessageTest("redefined-builtin", node=node.body[0], args="open")
+ MessageTest(
+ "redefined-builtin",
+ node=node.body[0],
+ args="open",
+ line=2,
+ col_offset=0,
+ end_line=2,
+ end_col_offset=32,
+ )
):
self.checker.visit_module(node)