[Python-checkins] Add double quote cases to invalid prefix tests (GH-19489)

Pablo Galindo webhook-mailer at python.org
Sun Apr 12 21:47:42 EDT 2020


https://github.com/python/cpython/commit/70c188eee019778583f19886e3b620d17bc86cd8
commit: 70c188eee019778583f19886e3b620d17bc86cd8
branch: master
author: Pablo Galindo <Pablogsal at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-04-13T02:47:35+01:00
summary:

Add double quote cases to invalid prefix tests (GH-19489)

files:
M Lib/test/test_fstring.py

diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py
index ef0ccb8cf53c1..8fd7cf09a99f4 100644
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -841,8 +841,7 @@ def test_nested_fstrings(self):
         self.assertEqual(f'{f"{y}"*3}', '555')
 
     def test_invalid_string_prefixes(self):
-        self.assertAllRaise(SyntaxError, 'invalid string prefix',
-                            ["fu''",
+        single_quote_cases = ["fu''",
                              "uf''",
                              "Fu''",
                              "fU''",
@@ -863,8 +862,10 @@ def test_invalid_string_prefixes(self):
                              "bf''",
                              "bF''",
                              "Bf''",
-                             "BF''",
-                             ])
+                             "BF''",]
+        double_quote_cases = [case.replace("'", '"') for case in single_quote_cases]
+        self.assertAllRaise(SyntaxError, 'invalid string prefix',
+                            single_quote_cases + double_quote_cases)
 
     def test_leading_trailing_spaces(self):
         self.assertEqual(f'{ 3}', '3')



More information about the Python-checkins mailing list