Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regression tests of inference of implicit None return #4428

Merged
merged 3 commits into from
May 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __contains__(self, _):

class Sizable(Structure):
def __len__(self):
pass
return 42

class Hashable(Structure):
__hash__ = 42
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/a/abstract/abstract_method_py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __contains__(self, _):
# +1: [abstract-method, abstract-method, abstract-method]
class Sizable(Structure):
def __len__(self):
pass
return 42


# +1: [abstract-method, abstract-method, abstract-method]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# pylint: disable=missing-docstring,pointless-statement,invalid-name,no-self-use

class A:
def func(self):
print('hello')

@property
def index(self):
print('world')


# Since these are not assigned anywhere, assignment-from-none etc.
# in typecheck does not warn

a = A()
# double call is workaround for #4426
a.func()() # [not-callable]
[1, 2, 3][a.index] # [invalid-sequence-index]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
not-callable:17:0::a.func() is not callable
invalid-sequence-index:18:0::Sequence index is not an int, slice, or instance with __index__