diff options
author | Martin Vielsmaier <martin.vielsmaier@gmail.com> | 2019-05-05 10:16:07 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2019-05-05 10:16:07 +0200 |
commit | 7054204c688947e6c056cde27190951bfe8f63e9 (patch) | |
tree | 05ff54f74e72008bfc6997f78eac6a6757c50bd8 /pylint/test | |
parent | c26bd45edb74f1857471fcd134c8443058670790 (diff) | |
download | pylint-git-7054204c688947e6c056cde27190951bfe8f63e9.tar.gz |
Fix crash in callable check (#2901)
Diffstat (limited to 'pylint/test')
-rw-r--r-- | pylint/test/unittest_checker_typecheck.py | 16 |
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) |