summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tokenize.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-02-09 21:28:07 (GMT)
committerGeorg Brandl <georg@python.org>2007-02-09 21:28:07 (GMT)
commit88fc6646d1b97cb3ba6188808e7c016884d44a73 (patch)
tree4cf73aca05a06e89ae71a719c7b2329af51392b8 /Lib/test/test_tokenize.py
parent08c47ba0df4ba87cdce34c126e5bdb28f8c6034c (diff)
downloadcpython-88fc6646d1b97cb3ba6188808e7c016884d44a73.zip
cpython-88fc6646d1b97cb3ba6188808e7c016884d44a73.tar.gz
cpython-88fc6646d1b97cb3ba6188808e7c016884d44a73.tar.bz2
* Remove PRINT_ITEM(_TO), PRINT_NEWLINE(_TO) opcodes.
* Fix some docstrings and one Print -> print. * Fix test_{class,code,descrtut,dis,extcall,parser,popen,pkg,subprocess,syntax,traceback}. These were the ones that generated code with a print statement. In most remaining failing tests there's an issue with the soft space.
Diffstat (limited to 'Lib/test/test_tokenize.py')
-rw-r--r--Lib/test/test_tokenize.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py
index 7d6a818..138ed74 100644
--- a/Lib/test/test_tokenize.py
+++ b/Lib/test/test_tokenize.py
@@ -43,9 +43,9 @@ regenerate the original program text from the tokens.
There are some standard formatting practices that are easy to get right.
>>> roundtrip("if x == 1:\\n"
-... " print x\\n")
+... " print(x)\\n")
if x == 1:
- print x
+ print(x)
Some people use different formatting conventions, which makes
untokenize a little trickier. Note that this test involves trailing
@@ -53,29 +53,29 @@ whitespace after the colon. Note that we use hex escapes to make the
two trailing blanks apparent in the expected output.
>>> roundtrip("if x == 1 : \\n"
-... " print x\\n")
+... " print(x)\\n")
if x == 1 :\x20\x20
- print x
+ print(x)
Comments need to go in the right place.
>>> roundtrip("if x == 1:\\n"
... " # A comment by itself.\\n"
-... " print x # Comment here, too.\\n"
+... " print(x) # Comment here, too.\\n"
... " # Another comment.\\n"
... "after_if = True\\n")
if x == 1:
# A comment by itself.
- print x # Comment here, too.
+ print(x) # Comment here, too.
# Another comment.
after_if = True
>>> roundtrip("if (x # The comments need to go in the right place\\n"
... " == 1):\\n"
-... " print 'x == 1'\\n")
+... " print('x == 1')\\n")
if (x # The comments need to go in the right place
== 1):
- print 'x == 1'
+ print('x == 1')
"""
@@ -130,9 +130,9 @@ def decistmt(s):
"""Substitute Decimals for floats in a string of statements.
>>> from decimal import Decimal
- >>> s = 'print +21.3e-5*-.1234/81.7'
+ >>> s = 'print(+21.3e-5*-.1234/81.7)'
>>> decistmt(s)
- "print +Decimal ('21.3e-5')*-Decimal ('.1234')/Decimal ('81.7')"
+ "print (+Decimal ('21.3e-5')*-Decimal ('.1234')/Decimal ('81.7'))"
The format of the exponent is inherited from the platform C library.
Known cases are "e-007" (Windows) and "e-07" (not Windows). Since