Better fstring handling for FORMAT_VALUE | 0x4

This commit is contained in:
rocky
2019-04-30 23:05:47 -04:00
parent f54cf20d9d
commit fac365f216
3 changed files with 16 additions and 4 deletions

View File

@@ -134,6 +134,10 @@ if PYTHON_VERSION > 2.6:
deparsed = deparse_code(PYTHON_VERSION, code, compile_mode='single')
recompiled = compile(deparsed.text, '<string>', 'single')
if recompiled != code:
print(recompiled)
print('================')
print(code)
print('----------------')
assert 'dis(' + deparsed.text.strip('\n') + ')' == 'dis(' + expr.strip('\n') + ')'
@@ -144,7 +148,7 @@ if PYTHON_VERSION > 2.6:
run_test(fstring)
@pytest.mark.skipif(PYTHON_VERSION < 3.6, reason='need Python 3.6+')
@pytest.mark.skipif(PYTHON_VERSION != 3.6, reason='need Python 3.6+')
@pytest.mark.parametrize('fstring', [
"f'{abc}{abc!s}'",
"f'{abc}0'",