summaryrefslogtreecommitdiff
path: root/pylint/test
diff options
context:
space:
mode:
authorMartin Vielsmaier <martin.vielsmaier@gmail.com>2019-05-05 10:16:07 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2019-05-05 10:16:07 +0200
commit7054204c688947e6c056cde27190951bfe8f63e9 (patch)
tree05ff54f74e72008bfc6997f78eac6a6757c50bd8 /pylint/test
parentc26bd45edb74f1857471fcd134c8443058670790 (diff)
downloadpylint-git-7054204c688947e6c056cde27190951bfe8f63e9.tar.gz
Fix crash in callable check (#2901)
Diffstat (limited to 'pylint/test')
-rw-r--r--pylint/test/unittest_checker_typecheck.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/pylint/test/unittest_checker_typecheck.py b/pylint/test/unittest_checker_typecheck.py
index 7bce396c5..ba61a7d13 100644
--- a/pylint/test/unittest_checker_typecheck.py
+++ b/pylint/test/unittest_checker_typecheck.py
@@ -332,3 +332,19 @@ class TestTypeChecker(CheckerTestCase):
)
with self.assertNoMessages():
self.checker.visit_call(call)
+
+ def test_unknown_parent(self):
+ """Make sure the callable check does not crash when a node's parent
+ cannot be determined.
+ """
+ call = astroid.extract_node(
+ """
+ def get_num(n):
+ return 2 * n
+ get_num(10)()
+ """
+ )
+ with self.assertAddsMessages(
+ Message("not-callable", node=call, args="get_num(10)")
+ ):
+ self.checker.visit_call(call)