Fix a few tests that failed, because they were not correct python (the context was wrong).

This commit is contained in:
Dave Halter
2016-05-30 20:10:17 +02:00
parent 4f6368e7eb
commit c12dbe0b9e
6 changed files with 18 additions and 19 deletions

View File

@@ -95,7 +95,6 @@ def get_stack_at_position(grammar, source, module, pos):
else:
if user_stmt is None:
user_stmt = module.get_leaf_for_position(pos, include_prefixes=True)
print(user_stmt)
if pos <= user_stmt.start_pos:
try:
leaf = user_stmt.get_previous_leaf()
@@ -103,6 +102,7 @@ def get_stack_at_position(grammar, source, module, pos):
pass
else:
user_stmt = get_user_or_error_stmt(module, leaf.start_pos)
print(user_stmt, leaf.start_pos)
# Only if were in front of the leaf we want to get the stack,
# because after there's probably a newline or whatever that would
# be actually tokenized and is not just prefix.
@@ -128,7 +128,6 @@ def get_stack_at_position(grammar, source, module, pos):
# Error leafs cannot be parsed.
raise OnErrorLeaf(user_stmt)
print(user_stmt.start_pos, pos)
code = _get_code(source, user_stmt.start_pos, pos)
# Remove whitespace at the end. Necessary, because the tokenizer will parse
# an error token (there's no new line at the end in our case). This doesn't

View File

@@ -38,7 +38,7 @@ exe[1]
#? set
exe[2]
#? []
exe[3][0]
exe[3][0].
#? str()
exe[4]['d']
@@ -70,7 +70,7 @@ exe[1]
#? set
exe[2]
#? []
exe[3][0]
exe[3][0].
#? str()
exe[4]['d']

View File

@@ -62,14 +62,14 @@ class B():
p = property(t)
#? []
B().r()
B().r().
#? int()
B().r
#? str()
B().p
#? []
B().p()
B().p().
class PropClass():
def __init__(self, a):

View File

@@ -368,12 +368,12 @@ def nested_args2(*args, **kwargs):
#? int()
nested_args('', 1, 1.0, list)
#? []
nested_args('')
nested_args('').
#? int()
nested_args2('', 1, 1.0)
#? []
nested_args2('')
nested_args2('').
# -----------------
# nested **kwargs
@@ -397,9 +397,9 @@ nested_kw(a=3.0, b=1)
#? int()
nested_kw(b=1, a=r"")
#? []
nested_kw(1, '')
nested_kw(1, '').
#? []
nested_kw(a='')
nested_kw(a='').
#? int()
nested_kw2(b=1)
@@ -408,9 +408,9 @@ nested_kw2(b=1, c=1.0)
#? int()
nested_kw2(c=1.0, b=1)
#? []
nested_kw2('')
nested_kw2('').
#? []
nested_kw2(a='')
nested_kw2(a='').
#? []
nested_kw2('', b=1).
@@ -430,14 +430,14 @@ nested_both('', b=1, c=1.0, list)
nested_both('', c=1.0, b=1, list)
#? []
nested_both('')
nested_both('').
#? int()
nested_both2('', b=1, c=1.0)
#? int()
nested_both2('', c=1.0, b=1)
#? []
nested_both2('')
nested_both2('').
# -----------------
# nested *args/**kwargs with a default arg
@@ -464,7 +464,7 @@ nested_def2('', b=1, c=1.0)[1]
#? int()
nested_def2('', c=1.0, b=1)[1]
#? []
nested_def2('')[1]
nested_def2('')[1].
# -----------------
# magic methods

View File

@@ -22,7 +22,7 @@ def gen_ret(value):
next(gen_ret(1))
#? []
next(gen_ret())
next(gen_ret()).
# generators evaluate to true if cast by bool.
a = ''
@@ -42,7 +42,7 @@ def get(param):
yield ""
#? []
get()[0]
get()[0].
# -----------------
# __iter__

View File

@@ -86,8 +86,8 @@ from os import path
# should not return a function, because `a` is a function above
def f(b, a): return a
#? ['in', 'is', 'and', 'if', 'or', 'not']
f(b=3)
#? []
f(b=3).
# -----------------
# closure