From 5d6719ed8c1a5c78a430dea8617e70c9db19096a Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Tue, 21 May 2013 14:23:26 +0200 Subject: [PATCH] Add tests for defined_names + full_name --- test/test_full_name.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/test_full_name.py b/test/test_full_name.py index 15a660c2..3094f192 100644 --- a/test/test_full_name.py +++ b/test/test_full_name.py @@ -36,6 +36,28 @@ class TestFullNameWithCompletions(MixinTestFullName, TestBase): get_definitions = TestBase.completions +class TestFullDefinedName(TestBase): + + def check(self, source, desired): + definitions = jedi.defined_names(textwrap.dedent(source)) + full_names = [d.full_name for d in definitions] + self.assertEqual(full_names, desired) + + def test_local_names(self): + self.check(""" + def f(): pass + class C: pass + """, ['f', 'C']) + + def test_imports(self): + self.check(""" + import os + from os import path + from os.path import join + from os import path as opath + """, ['os', 'os.path', 'os.path.join', 'os.path']) + + def test_keyword_full_name_should_be_none(): """issue #94""" # Using `from jedi.keywords import Keyword` here does NOT work