Skip to content

Commit

Permalink
Modify the arguments-differ tests for different output messages
Browse files Browse the repository at this point in the history
This commit modifies the tests for arguments-differ output messages based on different error cases.
It is part one of the issue pylint-dev#3536
  • Loading branch information
ksaketou committed Apr 29, 2021
1 parent 4faf101 commit 9eb140b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
22 changes: 11 additions & 11 deletions tests/functional/a/arguments_differ_py3.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
# pylint: disable=missing-docstring,too-few-public-methods
class AbstractFoo:

def kwonly_1(self, first, *, second, third):
def kwonly_1(self, first: int, *, second: int, third: int):
"Normal positional with two positional only params."

def kwonly_2(self, *, first, second):
def kwonly_2(self, *, first: str, second: str):
"Two positional only parameter."

def kwonly_3(self, *, first, second):
def kwonly_3(self, *, first: str, second: str):
"Two positional only params."

def kwonly_4(self, *, first, second=None):
def kwonly_4(self, *, first: str, second=None):
"One positional only and another with a default."

def kwonly_5(self, *, first, **kwargs):
def kwonly_5(self, *, first: bool, **kwargs):
"Keyword only and keyword variadics."

def kwonly_6(self, first, second, *, third):
def kwonly_6(self, first: float, second: float, *, third: int):
"Two positional and one keyword"


class Foo(AbstractFoo):

def kwonly_1(self, first, *, second): # [arguments-differ]
def kwonly_1(self, first: int, *, second: int): # [arguments-differ]
"One positional and only one positional only param."

def kwonly_2(self, first): # [arguments-differ]
def kwonly_2(self, *, first: str): # [arguments-differ]
"Only one positional parameter instead of two positional only parameters."

def kwonly_3(self, first, second): # [arguments-differ]
def kwonly_3(self, **kwargs):
"Two positional params."

def kwonly_4(self, first, second): # [arguments-differ]
def kwonly_4(self, *args): # [arguments-differ]
"Two positional params."

def kwonly_5(self, *, first): # [arguments-differ]
def kwonly_5(self, *, first: bool): # [arguments-differ]
"Keyword only, but no variadics."

def kwonly_6(self, *args, **kwargs): # valid override
Expand Down
9 changes: 4 additions & 5 deletions tests/functional/a/arguments_differ_py3.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
arguments-differ:25:4:Foo.kwonly_1:Parameters differ from overridden 'kwonly_1' method
arguments-differ:28:4:Foo.kwonly_2:Parameters differ from overridden 'kwonly_2' method
arguments-differ:31:4:Foo.kwonly_3:Parameters differ from overridden 'kwonly_3' method
arguments-differ:34:4:Foo.kwonly_4:Parameters differ from overridden 'kwonly_4' method
arguments-differ:37:4:Foo.kwonly_5:Parameters differ from overridden 'kwonly_5' method
arguments-differ:25:4:Foo.kwonly_1:Number of parameters has changed in overridden 'Foo.kwonly_1' method
arguments-differ:28:4:Foo.kwonly_2:Number of parameters has changed in overridden 'Foo.kwonly_2' method
arguments-differ:34:4:Foo.kwonly_4:Number of parameters has changed in overridden 'Foo.kwonly_4' method
arguments-differ:37:4:Foo.kwonly_5:Variadics removed in overridden 'Foo.kwonly_5' method

0 comments on commit 9eb140b

Please sign in to comment.