forked from VimPlug/jedi
Move another few tests.
This commit is contained in:
@@ -2,7 +2,6 @@ from textwrap import dedent
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import jedi
|
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
from jedi.common import splitlines
|
from jedi.common import splitlines
|
||||||
from jedi import cache
|
from jedi import cache
|
||||||
@@ -386,38 +385,6 @@ def test_node_insertion(differ):
|
|||||||
differ.parse(code2, parsers=1, copies=2)
|
differ.parse(code2, parsers=1, copies=2)
|
||||||
|
|
||||||
|
|
||||||
def test_add_to_end():
|
|
||||||
"""
|
|
||||||
fast_parser doesn't parse everything again. It just updates with the
|
|
||||||
help of caches, this is an example that didn't work.
|
|
||||||
"""
|
|
||||||
|
|
||||||
a = dedent("""\
|
|
||||||
class Abc():
|
|
||||||
def abc(self):
|
|
||||||
self.x = 3
|
|
||||||
|
|
||||||
class Two(Abc):
|
|
||||||
def g(self):
|
|
||||||
self
|
|
||||||
""") # ^ here is the first completion
|
|
||||||
|
|
||||||
b = " def h(self):\n" \
|
|
||||||
" self."
|
|
||||||
|
|
||||||
def complete(code, line=None, column=None):
|
|
||||||
script = jedi.Script(code, line, column, 'example.py')
|
|
||||||
assert script.completions()
|
|
||||||
_assert_valid_graph(script._get_module())
|
|
||||||
|
|
||||||
complete(a, 7, 12)
|
|
||||||
complete(a + b)
|
|
||||||
|
|
||||||
a = a[:-1] + '.\n'
|
|
||||||
complete(a, 7, 13)
|
|
||||||
complete(a + b)
|
|
||||||
|
|
||||||
|
|
||||||
def test_whitespace_at_end(differ):
|
def test_whitespace_at_end(differ):
|
||||||
code = dedent('str\n\n')
|
code = dedent('str\n\n')
|
||||||
|
|
||||||
|
|||||||
@@ -147,12 +147,6 @@ class TokenTest(unittest.TestCase):
|
|||||||
assert safe_literal_eval(string_tok.value) == 'test'
|
assert safe_literal_eval(string_tok.value) == 'test'
|
||||||
|
|
||||||
|
|
||||||
def test_tokenizer_with_string_literal_backslash():
|
|
||||||
import jedi
|
|
||||||
c = jedi.Script("statement = u'foo\\\n'; statement").goto_definitions()
|
|
||||||
assert c[0]._name._context.obj == 'foo'
|
|
||||||
|
|
||||||
|
|
||||||
def test_ur_literals():
|
def test_ur_literals():
|
||||||
"""
|
"""
|
||||||
Decided to parse `u''` literals regardless of Python version. This makes
|
Decided to parse `u''` literals regardless of Python version. This makes
|
||||||
|
|||||||
@@ -50,3 +50,38 @@ def test_class_and_if():
|
|||||||
assert [d.name for d in jedi.Script(src).goto_definitions()] == ['int']
|
assert [d.name for d in jedi.Script(src).goto_definitions()] == ['int']
|
||||||
|
|
||||||
|
|
||||||
|
def test_add_to_end():
|
||||||
|
"""
|
||||||
|
The diff parser doesn't parse everything again. It just updates with the
|
||||||
|
help of caches, this is an example that didn't work.
|
||||||
|
"""
|
||||||
|
|
||||||
|
a = dedent("""\
|
||||||
|
class Abc():
|
||||||
|
def abc(self):
|
||||||
|
self.x = 3
|
||||||
|
|
||||||
|
class Two(Abc):
|
||||||
|
def g(self):
|
||||||
|
self
|
||||||
|
""") # ^ here is the first completion
|
||||||
|
|
||||||
|
b = " def h(self):\n" \
|
||||||
|
" self."
|
||||||
|
|
||||||
|
def complete(code, line=None, column=None):
|
||||||
|
script = jedi.Script(code, line, column, 'example.py')
|
||||||
|
assert script.completions()
|
||||||
|
|
||||||
|
complete(a, 7, 12)
|
||||||
|
complete(a + b)
|
||||||
|
|
||||||
|
a = a[:-1] + '.\n'
|
||||||
|
complete(a, 7, 13)
|
||||||
|
complete(a + b)
|
||||||
|
|
||||||
|
|
||||||
|
def test_tokenizer_with_string_literal_backslash():
|
||||||
|
import jedi
|
||||||
|
c = jedi.Script("statement = u'foo\\\n'; statement").goto_definitions()
|
||||||
|
assert c[0]._name._context.obj == 'foo'
|
||||||
|
|||||||
Reference in New Issue
Block a user