mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 06:44:46 +08:00
remove interpreter test from test_regression
This commit is contained in:
42
test/test_interpreter.py
Normal file
42
test/test_interpreter.py
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
from .base import unittest
|
||||||
|
import jedi
|
||||||
|
from jedi._compatibility import is_py33
|
||||||
|
|
||||||
|
|
||||||
|
class TestInterpreterAPI(unittest.TestCase):
|
||||||
|
def check_interpreter_complete(self, source, namespace, completions,
|
||||||
|
**kwds):
|
||||||
|
script = jedi.Interpreter(source, [namespace], **kwds)
|
||||||
|
cs = script.complete()
|
||||||
|
actual = [c.word for c in cs]
|
||||||
|
self.assertEqual(sorted(actual), sorted(completions))
|
||||||
|
|
||||||
|
def test_complete_raw_function(self):
|
||||||
|
from os.path import join
|
||||||
|
self.check_interpreter_complete('join().up',
|
||||||
|
locals(),
|
||||||
|
['upper'])
|
||||||
|
|
||||||
|
def test_complete_raw_function_different_name(self):
|
||||||
|
from os.path import join as pjoin
|
||||||
|
self.check_interpreter_complete('pjoin().up',
|
||||||
|
locals(),
|
||||||
|
['upper'])
|
||||||
|
|
||||||
|
def test_complete_raw_module(self):
|
||||||
|
import os
|
||||||
|
self.check_interpreter_complete('os.path.join().up',
|
||||||
|
locals(),
|
||||||
|
['upper'])
|
||||||
|
|
||||||
|
def test_complete_raw_instance(self):
|
||||||
|
import datetime
|
||||||
|
dt = datetime.datetime(2013, 1, 1)
|
||||||
|
completions = ['time', 'timetz', 'timetuple']
|
||||||
|
if is_py33:
|
||||||
|
completions += ['timestamp']
|
||||||
|
self.check_interpreter_complete('(dt - dt).ti',
|
||||||
|
locals(),
|
||||||
|
completions)
|
||||||
|
|
||||||
|
|
||||||
@@ -439,43 +439,6 @@ class TestSpeed(TestBase):
|
|||||||
#print(jedi.imports.imports_processed)
|
#print(jedi.imports.imports_processed)
|
||||||
|
|
||||||
|
|
||||||
class TestInterpreterAPI(unittest.TestCase):
|
|
||||||
def check_interpreter_complete(self, source, namespace, completions,
|
|
||||||
**kwds):
|
|
||||||
script = api.Interpreter(source, [namespace], **kwds)
|
|
||||||
cs = script.complete()
|
|
||||||
actual = [c.word for c in cs]
|
|
||||||
self.assertEqual(sorted(actual), sorted(completions))
|
|
||||||
|
|
||||||
def test_complete_raw_function(self):
|
|
||||||
from os.path import join
|
|
||||||
self.check_interpreter_complete('join().up',
|
|
||||||
locals(),
|
|
||||||
['upper'])
|
|
||||||
|
|
||||||
def test_complete_raw_function_different_name(self):
|
|
||||||
from os.path import join as pjoin
|
|
||||||
self.check_interpreter_complete('pjoin().up',
|
|
||||||
locals(),
|
|
||||||
['upper'])
|
|
||||||
|
|
||||||
def test_complete_raw_module(self):
|
|
||||||
import os
|
|
||||||
self.check_interpreter_complete('os.path.join().up',
|
|
||||||
locals(),
|
|
||||||
['upper'])
|
|
||||||
|
|
||||||
def test_complete_raw_instance(self):
|
|
||||||
import datetime
|
|
||||||
dt = datetime.datetime(2013, 1, 1)
|
|
||||||
completions = ['time', 'timetz', 'timetuple']
|
|
||||||
if is_py33:
|
|
||||||
completions += ['timestamp']
|
|
||||||
self.check_interpreter_complete('(dt - dt).ti',
|
|
||||||
locals(),
|
|
||||||
completions)
|
|
||||||
|
|
||||||
|
|
||||||
def test_settings_module():
|
def test_settings_module():
|
||||||
"""
|
"""
|
||||||
jedi.settings and jedi.cache.settings must be the same module.
|
jedi.settings and jedi.cache.settings must be the same module.
|
||||||
|
|||||||
Reference in New Issue
Block a user