1
0
forked from VimPlug/jedi

Use locals() for tests in TestInterpreterAPI

It is better to check that Interpreter does not fail with the
real name space.  Previously the doctest using locals() failed
because of the bug in _import_raw_namespace.
This commit is contained in:
Takafumi Arakaki
2013-03-03 13:35:48 +01:00
parent a93016db1b
commit dc47d15de0
2 changed files with 13 additions and 9 deletions

View File

@@ -549,25 +549,28 @@ class TestInterpreterAPI(unittest.TestCase):
self.assertEqual(sorted(actual), sorted(completions))
def test_complete_raw_function(self):
from os.path import join
self.check_interpreter_complete('join().up',
{'join': os.path.join},
locals(),
['upper'])
def test_complete_raw_function_different_name(self):
from os.path import join as pjoin
self.check_interpreter_complete('pjoin().up',
{'pjoin': os.path.join},
locals(),
['upper'])
def test_complete_raw_module(self):
import os
self.check_interpreter_complete('os.path.join().up',
{'os': os},
locals(),
['upper'])
def test_complete_raw_instance(self):
import datetime
dt = datetime.datetime(2013, 1, 1)
self.check_interpreter_complete('(dt - dt).ti',
{'dt': dt},
locals(),
['time', 'timetz', 'timetuple'])