[Python-checkins] cpython (3.6): Update test_no_escapes_for_braces to clarify behavior with a docstring and
jason.coombs
python-checkins at python.org
Sun Nov 6 11:27:39 EST 2016
https://hg.python.org/cpython/rev/f18d6eb91b06
changeset: 104927:f18d6eb91b06
branch: 3.6
parent: 104925:1d8b8a67b657
user: Jason R. Coombs <jaraco at jaraco.com>
date: Sun Nov 06 11:25:54 2016 -0500
summary:
Update test_no_escapes_for_braces to clarify behavior with a docstring and expressions that clearly are not evaluated.
files:
Lib/test/test_fstring.py | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -382,11 +382,14 @@
])
def test_no_escapes_for_braces(self):
- # \x7b is '{'. Make sure it doesn't start an expression.
- self.assertEqual(f'\x7b2}}', '{2}')
- self.assertEqual(f'\x7b2', '{2')
- self.assertEqual(f'\u007b2', '{2')
- self.assertEqual(f'\N{LEFT CURLY BRACKET}2\N{RIGHT CURLY BRACKET}', '{2}')
+ """
+ Only literal curly braces begin an expression.
+ """
+ # \x7b is '{'.
+ self.assertEqual(f'\x7b1+1}}', '{1+1}')
+ self.assertEqual(f'\x7b1+1', '{1+1')
+ self.assertEqual(f'\u007b1+1', '{1+1')
+ self.assertEqual(f'\N{LEFT CURLY BRACKET}1+1\N{RIGHT CURLY BRACKET}', '{1+1}')
def test_newlines_in_expressions(self):
self.assertEqual(f'{0}', '0')
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list