From 610b2fc83208570d0691c13b0ea5cadaca290608 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Fri, 19 Sep 2014 00:49:22 +0200 Subject: [PATCH] tests for goto on imports. --- test/test_api/test_api_classes.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/test_api/test_api_classes.py b/test/test_api/test_api_classes.py index 193805f4..16ac3efc 100644 --- a/test/test_api/test_api_classes.py +++ b/test/test_api/test_api_classes.py @@ -253,3 +253,17 @@ class TestGotoAssignments(TestCase): def test_parentheses(self): n = names('("").upper', references=True)[-1] assert n.goto_assignments()[0].name == 'upper' + + def test_import(self): + nms = names('from json import decode', references=True) + assert nms[0].name == 'json' + assert nms[0].type == 'import' + n = nms[0].goto_assignments()[0] + assert n.name == 'json' + assert n.type == 'module' + + assert nms[1].name == 'decode' + assert nms[1].type == 'import' + n = nms[1].goto_assignments()[0] + assert n.name == 'decode' + assert n.type == 'function'