summaryrefslogtreecommitdiff
path: root/Lib/test/test_print.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_print.py')
-rw-r--r--Lib/test/test_print.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_print.py b/Lib/test/test_print.py
index e6434feaf5..7bc23cf9fc 100644
--- a/Lib/test/test_print.py
+++ b/Lib/test/test_print.py
@@ -156,6 +156,15 @@ class TestPy2MigrationHint(unittest.TestCase):
self.assertIn('print("Hello World", end=" ")', str(context.exception))
+ def test_string_with_leading_whitespace(self):
+ python2_print_str = '''if 1:
+ print "Hello World"
+ '''
+ with self.assertRaises(SyntaxError) as context:
+ exec(python2_print_str)
+
+ self.assertIn('print("Hello World")', str(context.exception))
+
def test_stream_redirection_hint_for_py2_migration(self):
# Test correct hint produced for Py2 redirection syntax
with self.assertRaises(TypeError) as context: