mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 07:14:48 +08:00
Small test corrections.
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
from jedi.parser import Parser
|
from jedi.parser import Parser, load_grammar
|
||||||
|
|
||||||
|
|
||||||
def test_basic_parsing():
|
def test_basic_parsing():
|
||||||
def compare(string):
|
def compare(string):
|
||||||
"""Generates the AST object and then regenerates the code."""
|
"""Generates the AST object and then regenerates the code."""
|
||||||
assert Parser(string).module.get_code() == string
|
assert Parser(load_grammar(), string).module.get_code() == string
|
||||||
|
|
||||||
compare('\na #pass\n')
|
compare('\na #pass\n')
|
||||||
compare('wblabla* 1\t\n')
|
compare('wblabla* 1\t\n')
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from jedi._compatibility import u
|
|||||||
from jedi import Script
|
from jedi import Script
|
||||||
from jedi import api
|
from jedi import api
|
||||||
from jedi.evaluate import imports
|
from jedi.evaluate import imports
|
||||||
from jedi.parser import Parser
|
from jedi.parser import Parser, load_grammar
|
||||||
|
|
||||||
#jedi.set_debug_function()
|
#jedi.set_debug_function()
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ class TestRegression(TestCase):
|
|||||||
|
|
||||||
assert should2 == diff_line
|
assert should2 == diff_line
|
||||||
|
|
||||||
self.assertRaises(jedi.NotFoundError, get_def, cls)
|
assert get_def(cls) == []
|
||||||
|
|
||||||
@pytest.mark.skipif('True', reason='Skip for now, test case is not really supported.')
|
@pytest.mark.skipif('True', reason='Skip for now, test case is not really supported.')
|
||||||
@cwd_at('jedi')
|
@cwd_at('jedi')
|
||||||
@@ -98,13 +98,12 @@ class TestRegression(TestCase):
|
|||||||
self.assertEqual([d.description for d in defs],
|
self.assertEqual([d.description for d in defs],
|
||||||
['def f', 'class C'])
|
['def f', 'class C'])
|
||||||
|
|
||||||
def test_end_pos(self):
|
def test_end_pos_line(self):
|
||||||
# jedi issue #150
|
# jedi issue #150
|
||||||
s = u("x()\nx( )\nx( )\nx ( )")
|
s = u("x()\nx( )\nx( )\nx ( )")
|
||||||
parser = Parser(s)
|
parser = Parser(load_grammar(), s)
|
||||||
for i, s in enumerate(parser.module.statements, 3):
|
for i, s in enumerate(parser.module.statements):
|
||||||
for c in s.expression_list():
|
assert s.end_pos == (i + 1, i + 3)
|
||||||
self.assertEqual(c.next.end_pos[1], i)
|
|
||||||
|
|
||||||
def check_definition_by_marker(self, source, after_cursor, names):
|
def check_definition_by_marker(self, source, after_cursor, names):
|
||||||
r"""
|
r"""
|
||||||
|
|||||||
Reference in New Issue
Block a user