Small test corrections.

This commit is contained in:
Dave Halter
2014-12-11 04:44:27 +01:00
parent 2dd8ed2270
commit d8067a7286
2 changed files with 8 additions and 9 deletions

View File

@@ -1,10 +1,10 @@
from jedi.parser import Parser
from jedi.parser import Parser, load_grammar
def test_basic_parsing():
def compare(string):
"""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('wblabla* 1\t\n')

View File

@@ -15,7 +15,7 @@ from jedi._compatibility import u
from jedi import Script
from jedi import api
from jedi.evaluate import imports
from jedi.parser import Parser
from jedi.parser import Parser, load_grammar
#jedi.set_debug_function()
@@ -55,7 +55,7 @@ class TestRegression(TestCase):
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.')
@cwd_at('jedi')
@@ -98,13 +98,12 @@ class TestRegression(TestCase):
self.assertEqual([d.description for d in defs],
['def f', 'class C'])
def test_end_pos(self):
def test_end_pos_line(self):
# jedi issue #150
s = u("x()\nx( )\nx( )\nx ( )")
parser = Parser(s)
for i, s in enumerate(parser.module.statements, 3):
for c in s.expression_list():
self.assertEqual(c.next.end_pos[1], i)
parser = Parser(load_grammar(), s)
for i, s in enumerate(parser.module.statements):
assert s.end_pos == (i + 1, i + 3)
def check_definition_by_marker(self, source, after_cursor, names):
r"""