Skip to content

Commit 2735022

Browse files
committed
Failing test case.
1 parent 649c875 commit 2735022

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""
2+
https://github.com/pylint-dev/pylint/issues/9519
3+
"""
4+
5+
# pylint: disable=missing-class-docstring,missing-function-docstring,too-few-public-methods
6+
class Window:
7+
def print_text(self, txt):
8+
print(f'{__class__} {txt}')
9+
10+
11+
class Win(Window):
12+
def __init__(self, txt):
13+
super().__init__(txt)
14+
15+
Win('hello')

tests/test_self.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,22 @@ def test_wrong_import_position_when_others_disabled(self) -> None:
341341
actual_output = actual_output[actual_output.find("\n") :]
342342
assert self._clean_paths(expected_output.strip()) == actual_output.strip()
343343

344+
def test_super_init_with_non_self_argument(self) -> None:
345+
module1 = join(HERE, "regrtest_data", "super_init_with_non_self_argument.py")
346+
args = [ module1 ]
347+
out = StringIO()
348+
self._run_pylint(args, out=out)
349+
actual_output = self._clean_paths(out.getvalue().strip())
350+
351+
expected_output = textwrap.dedent(
352+
f"""
353+
************* Module super_init_with_non_self_argument
354+
{module1}:11:0: blah
355+
"""
356+
)
357+
assert "Your code has been rated at 10.00/10" not in actual_output, "bad code should fail."
358+
assert self._clean_paths(expected_output.strip()) == actual_output.strip()
359+
344360
def test_progress_reporting(self) -> None:
345361
module1 = join(HERE, "regrtest_data", "import_something.py")
346362
module2 = join(HERE, "regrtest_data", "wrong_import_position.py")

0 commit comments

Comments
 (0)