summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_traceback.py
diff options
context:
space:
mode:
authorEric V. Smith <eric@trueblade.com>2016-09-10 01:56:20 (GMT)
committerEric V. Smith <eric@trueblade.com>2016-09-10 01:56:20 (GMT)
commit451d0e38fcf50d976236d7d00ccfe8c1a2305086 (patch)
tree29e15833e76714f8f0f8b906871b82c8c1a42967 /Lib/test/test_traceback.py
parent052828db1538bf0d42d7e256da13c6e183974a13 (diff)
downloadcpython-451d0e38fcf50d976236d7d00ccfe8c1a2305086.zip
cpython-451d0e38fcf50d976236d7d00ccfe8c1a2305086.tar.gz
cpython-451d0e38fcf50d976236d7d00ccfe8c1a2305086.tar.bz2
Issue 27948: Allow backslashes in the literal string portion of f-strings, but not in the expressions. Also, require expressions to begin and end with literal curly braces.
Diffstat (limited to 'Lib/test/test_traceback.py')
-rw-r--r--Lib/test/test_traceback.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py
index 446b91e..037d883 100644
--- a/Lib/test/test_traceback.py
+++ b/Lib/test/test_traceback.py
@@ -326,13 +326,13 @@ class TracebackFormatTests(unittest.TestCase):
lineno_f = f.__code__.co_firstlineno
result_f = (
'Traceback (most recent call last):\n'
- f' File "{__file__}", line {lineno_f+5}, in _check_recursive_traceback_display''\n'
+ f' File "{__file__}", line {lineno_f+5}, in _check_recursive_traceback_display\n'
' f()\n'
- f' File "{__file__}", line {lineno_f+1}, in f''\n'
+ f' File "{__file__}", line {lineno_f+1}, in f\n'
' f()\n'
- f' File "{__file__}", line {lineno_f+1}, in f''\n'
+ f' File "{__file__}", line {lineno_f+1}, in f\n'
' f()\n'
- f' File "{__file__}", line {lineno_f+1}, in f''\n'
+ f' File "{__file__}", line {lineno_f+1}, in f\n'
' f()\n'
# XXX: The following line changes depending on whether the tests
# are run through the interactive interpreter or with -m
@@ -371,20 +371,20 @@ class TracebackFormatTests(unittest.TestCase):
lineno_g = g.__code__.co_firstlineno
result_g = (
- f' File "{__file__}", line {lineno_g+2}, in g''\n'
+ f' File "{__file__}", line {lineno_g+2}, in g\n'
' return g(count-1)\n'
- f' File "{__file__}", line {lineno_g+2}, in g''\n'
+ f' File "{__file__}", line {lineno_g+2}, in g\n'
' return g(count-1)\n'
- f' File "{__file__}", line {lineno_g+2}, in g''\n'
+ f' File "{__file__}", line {lineno_g+2}, in g\n'
' return g(count-1)\n'
' [Previous line repeated 6 more times]\n'
- f' File "{__file__}", line {lineno_g+3}, in g''\n'
+ f' File "{__file__}", line {lineno_g+3}, in g\n'
' raise ValueError\n'
'ValueError\n'
)
tb_line = (
'Traceback (most recent call last):\n'
- f' File "{__file__}", line {lineno_g+7}, in _check_recursive_traceback_display''\n'
+ f' File "{__file__}", line {lineno_g+7}, in _check_recursive_traceback_display\n'
' g()\n'
)
expected = (tb_line + result_g).splitlines()
@@ -408,16 +408,16 @@ class TracebackFormatTests(unittest.TestCase):
lineno_h = h.__code__.co_firstlineno
result_h = (
'Traceback (most recent call last):\n'
- f' File "{__file__}", line {lineno_h+7}, in _check_recursive_traceback_display''\n'
+ f' File "{__file__}", line {lineno_h+7}, in _check_recursive_traceback_display\n'
' h()\n'
- f' File "{__file__}", line {lineno_h+2}, in h''\n'
+ f' File "{__file__}", line {lineno_h+2}, in h\n'
' return h(count-1)\n'
- f' File "{__file__}", line {lineno_h+2}, in h''\n'
+ f' File "{__file__}", line {lineno_h+2}, in h\n'
' return h(count-1)\n'
- f' File "{__file__}", line {lineno_h+2}, in h''\n'
+ f' File "{__file__}", line {lineno_h+2}, in h\n'
' return h(count-1)\n'
' [Previous line repeated 6 more times]\n'
- f' File "{__file__}", line {lineno_h+3}, in h''\n'
+ f' File "{__file__}", line {lineno_h+3}, in h\n'
' g()\n'
)
expected = (result_h + result_g).splitlines()