Revise and hopefully improve 3.6+ fstring handling

This commit is contained in:
rocky
2019-05-08 06:03:39 -04:00
parent 393e5c9303
commit 733a44e22f
6 changed files with 156 additions and 79 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -4,8 +4,8 @@
var1 = 'x'
var2 = 'y'
abc = 'def'
assert (f'interpolate {var1} strings {var2!r} {var2!s} py36' ==
"interpolate x strings 'y' y py36")
assert (f"interpolate {var1} strings {var2!r} {var2!s} 'py36" ==
"interpolate x strings 'y' y 'py36")
assert 'def0' == f'{abc}0'
assert 'defdef' == f'{abc}{abc!s}'
@@ -38,4 +38,3 @@ filename = '.'
source = 'foo'
source = (f"__file__ = r'''{os.path.abspath(filename)}'''\n"
+ source + "\ndel __file__")
print(source)