Skip to content

Commit

Permalink
add more test examples
Browse files Browse the repository at this point in the history
  • Loading branch information
clavedeluna committed Oct 18, 2022
1 parent ed43df2 commit 46d491b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
6 changes: 3 additions & 3 deletions pylint/checkers/dunder_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
}


EXTRA_DUNDER_METHODS: list = [
EXTRA_DUNDER_METHODS = [
"__new__",
"__subclasses__",
"__init_subclass__",
Expand All @@ -134,10 +134,10 @@
"__setstate__",
"__reduce__",
"__reduce_ex__",
"__post_init__", # part of dataclasses module
"__post_init__", # part of dataclasses module
]

DUNDER_PROPERTIES: list = [
DUNDER_PROPERTIES = [
"__class__",
"__dict__",
"__doc__",
Expand Down
1 change: 0 additions & 1 deletion tests/functional/a/arguments_differ.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# pylint: disable=unused-private-member, bad-dunder-name

class Parent:

def test(self):
pass

Expand Down
26 changes: 13 additions & 13 deletions tests/functional/a/arguments_differ.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
arguments-differ:13:4:13:12:Child.test:Number of parameters was 1 in 'Parent.test' and is now 2 in overriding 'Child.test' method:UNDEFINED
arguments-differ:24:4:24:12:ChildDefaults.test:Number of parameters was 3 in 'ParentDefaults.test' and is now 2 in overriding 'ChildDefaults.test' method:UNDEFINED
arguments-differ:42:4:42:12:ClassmethodChild.func:Number of parameters was 2 in 'Classmethod.func' and is now 0 in overriding 'ClassmethodChild.func' method:UNDEFINED
arguments-differ:69:4:69:18:VarargsChild.has_kwargs:Variadics removed in overriding 'VarargsChild.has_kwargs' method:UNDEFINED
arguments-renamed:72:4:72:17:VarargsChild.no_kwargs:Parameter 'args' has been renamed to 'arg' in overriding 'VarargsChild.no_kwargs' method:UNDEFINED
arguments-differ:145:4:145:12:StaticmethodChild2.func:Number of parameters was 1 in 'Staticmethod.func' and is now 2 in overriding 'StaticmethodChild2.func' method:UNDEFINED
arguments-differ:181:4:181:12:SecondChangesArgs.test:Number of parameters was 2 in 'FirstHasArgs.test' and is now 4 in overriding 'SecondChangesArgs.test' method:UNDEFINED
arguments-differ:308:4:308:16:Foo.kwonly_1:Number of parameters was 4 in 'AbstractFoo.kwonly_1' and is now 3 in overriding 'Foo.kwonly_1' method:UNDEFINED
arguments-differ:311:4:311:16:Foo.kwonly_2:Number of parameters was 3 in 'AbstractFoo.kwonly_2' and is now 2 in overriding 'Foo.kwonly_2' method:UNDEFINED
arguments-differ:314:4:314:16:Foo.kwonly_3:Number of parameters was 3 in 'AbstractFoo.kwonly_3' and is now 3 in overriding 'Foo.kwonly_3' method:UNDEFINED
arguments-differ:317:4:317:16:Foo.kwonly_4:Number of parameters was 3 in 'AbstractFoo.kwonly_4' and is now 3 in overriding 'Foo.kwonly_4' method:UNDEFINED
arguments-differ:320:4:320:16:Foo.kwonly_5:Variadics removed in overriding 'Foo.kwonly_5' method:UNDEFINED
arguments-differ:360:4:360:14:ClassWithNewNonDefaultKeywordOnly.method:Number of parameters was 2 in 'AClass.method' and is now 3 in overriding 'ClassWithNewNonDefaultKeywordOnly.method' method:UNDEFINED
arguments-differ:12:4:12:12:Child.test:Number of parameters was 1 in 'Parent.test' and is now 2 in overriding 'Child.test' method:UNDEFINED
arguments-differ:23:4:23:12:ChildDefaults.test:Number of parameters was 3 in 'ParentDefaults.test' and is now 2 in overriding 'ChildDefaults.test' method:UNDEFINED
arguments-differ:41:4:41:12:ClassmethodChild.func:Number of parameters was 2 in 'Classmethod.func' and is now 0 in overriding 'ClassmethodChild.func' method:UNDEFINED
arguments-differ:68:4:68:18:VarargsChild.has_kwargs:Variadics removed in overriding 'VarargsChild.has_kwargs' method:UNDEFINED
arguments-renamed:71:4:71:17:VarargsChild.no_kwargs:Parameter 'args' has been renamed to 'arg' in overriding 'VarargsChild.no_kwargs' method:UNDEFINED
arguments-differ:144:4:144:12:StaticmethodChild2.func:Number of parameters was 1 in 'Staticmethod.func' and is now 2 in overriding 'StaticmethodChild2.func' method:UNDEFINED
arguments-differ:180:4:180:12:SecondChangesArgs.test:Number of parameters was 2 in 'FirstHasArgs.test' and is now 4 in overriding 'SecondChangesArgs.test' method:UNDEFINED
arguments-differ:307:4:307:16:Foo.kwonly_1:Number of parameters was 4 in 'AbstractFoo.kwonly_1' and is now 3 in overriding 'Foo.kwonly_1' method:UNDEFINED
arguments-differ:310:4:310:16:Foo.kwonly_2:Number of parameters was 3 in 'AbstractFoo.kwonly_2' and is now 2 in overriding 'Foo.kwonly_2' method:UNDEFINED
arguments-differ:313:4:313:16:Foo.kwonly_3:Number of parameters was 3 in 'AbstractFoo.kwonly_3' and is now 3 in overriding 'Foo.kwonly_3' method:UNDEFINED
arguments-differ:316:4:316:16:Foo.kwonly_4:Number of parameters was 3 in 'AbstractFoo.kwonly_4' and is now 3 in overriding 'Foo.kwonly_4' method:UNDEFINED
arguments-differ:319:4:319:16:Foo.kwonly_5:Variadics removed in overriding 'Foo.kwonly_5' method:UNDEFINED
arguments-differ:359:4:359:14:ClassWithNewNonDefaultKeywordOnly.method:Number of parameters was 2 in 'AClass.method' and is now 3 in overriding 'ClassWithNewNonDefaultKeywordOnly.method' method:UNDEFINED
6 changes: 6 additions & 0 deletions tests/functional/b/bad_dunder_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ def __inv__(self): # [bad-dunder-name]
# author likely meant to call the invert dunder method
pass

def _protected_method(self):
print("Protected")

def __private_method(self):
print("Private")

@property
def __doc__(self):
return "Docstring"
Expand Down

0 comments on commit 46d491b

Please sign in to comment.