aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_future.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_future.py')
-rw-r--r--Lib/test/test_future.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/Lib/test/test_future.py b/Lib/test/test_future.py
index dd148b62956..303c5f7fbed 100644
--- a/Lib/test/test_future.py
+++ b/Lib/test/test_future.py
@@ -270,12 +270,6 @@ class AnnotationsFutureTestCase(unittest.TestCase):
eq("f'{x}'")
eq("f'{x!r}'")
eq("f'{x!a}'")
- eq("f'{x=!r}'")
- eq("f'{x=:}'")
- eq("f'{x=:.2f}'")
- eq("f'{x=!r}'")
- eq("f'{x=!a}'")
- eq("f'{x=!s:*^20}'")
eq('(yield from outside_of_generator)')
eq('(yield)')
eq('(yield a + b)')
@@ -290,6 +284,15 @@ class AnnotationsFutureTestCase(unittest.TestCase):
eq("(x:=10)")
eq("f'{(x:=10):=10}'")
+ # f-strings with '=' don't round trip very well, so set the expected
+ # result explicitely.
+ self.assertAnnotationEqual("f'{x=!r}'", expected="f'x={x!r}'")
+ self.assertAnnotationEqual("f'{x=:}'", expected="f'x={x:}'")
+ self.assertAnnotationEqual("f'{x=:.2f}'", expected="f'x={x:.2f}'")
+ self.assertAnnotationEqual("f'{x=!r}'", expected="f'x={x!r}'")
+ self.assertAnnotationEqual("f'{x=!a}'", expected="f'x={x!a}'")
+ self.assertAnnotationEqual("f'{x=!s:*^20}'", expected="f'x={x!s:*^20}'")
+
if __name__ == "__main__":
unittest.main()