Commit 3caeb8ed authored by Stefan Behnel's avatar Stefan Behnel

Disable some unicode fstring tests for the debugging (f"{...=}") feature since...

Disable some unicode fstring tests for the debugging (f"{...=}") feature since unicode strings come out as "u'...'" in Py2.
parent 64055e5d
......@@ -61,9 +61,9 @@ class TestCase(CythonTest):
if first != second and isinstance(first, unicode):
stripped_first = first.replace(u"u'", u"'").replace(u'u"', u'"')
if stripped_first == second:
first = stripped_first
elif u'\\' in stripped_first and stripped_first.decode('unicode_escape') == second:
first = stripped_first.decode('unicode_escape')
first = second
elif u'\\' in stripped_first and stripped_first.encode('utf8').decode('unicode_escape') == second:
first = second
super(TestCase, self).assertEqual(first, second, msg)
def test__format__lookup(self):
......@@ -1150,6 +1150,7 @@ non-important content
self.assertEqual(f'{tenπ=:.2f}', 'tenπ=31.40')
# Also test with Unicode in non-identifiers.
if not IS_PY2: # unicode representation looks different right now - not sure if that's a good thing
self.assertEqual(f'{"Σ"=}', '"Σ"=\\'')
# Make sure nested fstrings still work.
......@@ -1158,7 +1159,8 @@ non-important content
# Make sure text before and after an expression with = works
# correctly.
pi = 'π'
self.assertEqual(f'alpha α {pi=} ω omega', "alpha α pi='π' ω omega")
if not IS_PY2: # unicode representation looks different right now - not sure if that's a good thing
self.assertEqual(f'alpha α {pi=} ω omega', u"alpha α pi='π' ω omega")
# Check multi-line expressions.
self.assertEqual(f'''{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment