Skip to content

Commit a870de7

Browse files
committed
test: pylint kotoha checker
1 parent 5ee0df9 commit a870de7

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

pylint/test_kotoha_plugin.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import astroid
2+
import pylint.testutils
3+
4+
import kotoha_plugin
5+
6+
7+
class TestArgumentListTypeHintChecker(pylint.testutils.CheckerTestCase):
8+
CHECKER_CLASS = kotoha_plugin.ArgumentListTypeHintChecker
9+
10+
def test_find_argument_list_type_hint(self):
11+
node = astroid.extract_node("""\
12+
def plus_one(numbers: list[int]) -> list[int]:
13+
return [n + 1 for n in numbers]
14+
""")
15+
16+
with self.assertAddsMessages(
17+
pylint.testutils.MessageTest(
18+
msg_id="avoid-list-arg-type",
19+
node=node.args.annotations[0],
20+
args=("list",),
21+
line=1,
22+
col_offset=22,
23+
end_line=1,
24+
end_col_offset=31,
25+
)
26+
):
27+
self.checker.visit_arguments(node.args)

0 commit comments

Comments
 (0)