solve unittest bugs and undetected develop_steps bug

This commit is contained in:
Benjamin Bertrand
2016-03-07 11:43:33 +03:00
parent 190b247fe4
commit 142eaa9c32
5 changed files with 49 additions and 43 deletions

View File

@@ -256,13 +256,19 @@ class Expression(Explicable):
for t in tokenList:
try:
with Expression.tmp_render():
tmp_steps.append([i for i in t.explain()])
steps = [i for i in t.explain()]
if steps:
tmp_steps.append(steps)
else:
tmp_steps.append([t])
except AttributeError:
tmp_steps.append([t])
if max([len(i) for i in tmp_steps]) == 1:
# Cas où rien n'a dû être expliqué.
return []
elif min([len(i) for i in tmp_steps]) == 0:
raise ValueError('tmp_steps: {} \ntokenList: {}'.format(tmp_steps, tokenList))
else:
tmp_steps = expand_list(tmp_steps)[:-1]
steps = [Expression(s) for s in tmp_steps]