summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Liu <david@cs.toronto.edu>2021-08-27 16:44:51 -0400
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-08-30 20:27:18 +0200
commitc81a7f1684aab2c69f0cd1411abbc0c9fbd93637 (patch)
treedf7aef6985ca1f122e0a933a61d0bbd79b688824
parentcc35589d1b6b12a88bb691d006e3cb0b81a4a9e5 (diff)
downloadpylint-git-c81a7f1684aab2c69f0cd1411abbc0c9fbd93637.tar.gz
Add regression tests for PyCQA/astroid#1151
-rw-r--r--tests/functional/a/assign/assignment_from_no_return.py24
-rw-r--r--tests/functional/n/no/no_member.py31
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