diff options
-rw-r--r-- | tests/functional/a/assign/assignment_from_no_return.py | 24 | ||||
-rw-r--r-- | tests/functional/n/no/no_member.py | 31 |
2 files changed, 54 insertions, 1 deletions
diff --git a/tests/functional/a/assign/assignment_from_no_return.py b/tests/functional/a/assign/assignment_from_no_return.py index 887eb8d2e..5415f6097 100644 --- a/tests/functional/a/assign/assignment_from_no_return.py +++ b/tests/functional/a/assign/assignment_from_no_return.py @@ -1,4 +1,4 @@ -# pylint: disable=missing-docstring +# pylint: disable=missing-docstring, invalid-name, too-few-public-methods, no-self-use def some_func(): @@ -54,3 +54,25 @@ class Child(Parent): """This is supported for this child class""" return 42 + + +# Regression test for https://github.com/PyCQA/pylint/issues/4220 +class A: + """Parent class""" + def f(self): + """This returns something""" + return 42 + + +class B(A): + """Child class""" + def __init__(self): + self.a = A() + result = self.a.f() # no error here + print(result) + + def f(self): + """This doesn't return anything""" + + +res = B().a.f() # no error here diff --git a/tests/functional/n/no/no_member.py b/tests/functional/n/no/no_member.py new file mode 100644 index 000000000..73b2227a6 --- /dev/null +++ b/tests/functional/n/no/no_member.py @@ -0,0 +1,31 @@ +# pylint: disable=missing-docstring, unused-argument, wrong-import-position, invalid-name + + +# Regression test for https://github.com/PyCQA/pylint/issues/400 +class TestListener: + def __init__(self): + self._latest = None + + def wait(self, timeout): + result = self._latest + self._latest = None + return result + + def peer_joined(self, peer): + self._latest = peer + + +listener = TestListener() +broker = listener.wait(3).get_domain() # No error here + + +# Regression test for https://github.com/PyCQA/pylint/issues/4377 +from urllib import parse + +url = 'http://www.google.com' + +parsed_url = parse.urlparse(url) +sorted_query = parse.urlencode( + sorted(parse.parse_qsl(parsed_url.query), key=lambda param: param[0])) +new_parsed_url = parse.ParseResult._replace(parsed_url, query=sorted_query) +new_url = new_parsed_url.geturl() # No error here |