further work on supporting single and multiple fstring decompilation

This commit is contained in:
moagstar
2016-10-20 20:44:27 +02:00
parent 7beaa9f36c
commit cec80e696c
4 changed files with 22 additions and 9 deletions

View File

@@ -21,9 +21,13 @@ def expressions(draw):
'container',
'self.attribute',
'self.method()',
# These expressions are failing, I think these are control
# flow problems rather than problems with FORMAT_VALUE,
# however I need to confirm this...
#'sorted(items, key=lambda x: x.name)',
#'func(*args, **kwargs)',
#'text or default',
#'43 if life_the_universe and everything else None'
)))
@@ -119,6 +123,8 @@ def test_format_specifiers(format_specifier):
def run_test(text):
hypothesis.assume(len(text))
hypothesis.assume("f'{" in text)
expr = text + '\n'
code = compile(expr, '<string>', 'single')
deparsed = deparse_code(PYTHON_VERSION, code, compile_mode='single')