bpo-35133: Fix mistakes when concatenate string literals on different lines. (GH-10284)
Two kind of mistakes:
1. Missed space. After concatenating there is no space between words.
2. Missed comma. Causes unintentional concatenating in a list of strings.
(cherry picked from commit 34fd4c20198dea6ab2fe8dc6d32d744d9bde868d)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index e7202cd..7c9768a 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -1600,7 +1600,7 @@
@unittest.skipIf(sys.flags.ignore_environment, '-E was given')
def test_envar_unimportable(self):
for envar in (
- '.', '..', '.foo', 'foo.', '.int', 'int.'
+ '.', '..', '.foo', 'foo.', '.int', 'int.',
'nosuchbuiltin',
'nosuchmodule.nosuchcallable',
):
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index acebdbd..d8a57e5 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -285,7 +285,7 @@
'from sys import stdin)',
'from sys import stdin, stdout,\nstderr',
'from sys import stdin si',
- 'from sys import stdin,'
+ 'from sys import stdin,',
'from sys import (*)',
'from sys import (stdin,, stdout, stderr)',
'from sys import (stdin, stdout),',
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py
index 58bde54..1f37b53 100644
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -1172,10 +1172,10 @@
decimal_point = locale.localeconv()['decimal_point']
thousands_sep = locale.localeconv()['thousands_sep']
if decimal_point != '\u066b':
- self.skipTest('inappropriate decimal point separator'
+ self.skipTest('inappropriate decimal point separator '
'({!a} not {!a})'.format(decimal_point, '\u066b'))
if thousands_sep != '\u066c':
- self.skipTest('inappropriate thousands separator'
+ self.skipTest('inappropriate thousands separator '
'({!a} not {!a})'.format(thousands_sep, '\u066c'))
self.assertEqual(format(Decimal('100000000.123'), 'n'),
diff --git a/Lib/test/test_http_cookiejar.py b/Lib/test/test_http_cookiejar.py
index 6fee4df..abc625d 100644
--- a/Lib/test/test_http_cookiejar.py
+++ b/Lib/test/test_http_cookiejar.py
@@ -174,12 +174,10 @@
'1980-01-01 00:61:00',
'01-01-1980 00:00:62',
'01-01-1980T00:00:62',
- '19800101T250000Z'
- '1980-01-01 00:00:00 -2500',
+ '19800101T250000Z',
]:
self.assertIsNone(iso2time(test),
- "iso2time(%s) is not None\n"
- "iso2time(test) %s" % (test, iso2time(test)))
+ "iso2time(%r)" % test)
class HeaderTests(unittest.TestCase):
diff --git a/Lib/test/test_range.py b/Lib/test/test_range.py
index ce15847..94c96a9 100644
--- a/Lib/test/test_range.py
+++ b/Lib/test/test_range.py
@@ -39,7 +39,7 @@
self.fail('{}: unexpected excess element {} at '
'position {}'.format(test_id, x, i))
else:
- self.fail('{}: wrong element at position {};'
+ self.fail('{}: wrong element at position {}; '
'expected {}, got {}'.format(test_id, i, y, x))
def test_range(self):
diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py
index 8a29e98..b4149d3 100644
--- a/Lib/test/test_smtplib.py
+++ b/Lib/test/test_smtplib.py
@@ -770,7 +770,7 @@
try:
user, hashed_pass = logpass.split()
except ValueError as e:
- self.push('535 Splitting response {!r} into user and password'
+ self.push('535 Splitting response {!r} into user and password '
'failed: {}'.format(logpass, e))
return False
valid_hashed_pass = hmac.HMAC(
diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py
index de2773f..a3358a4 100644
--- a/Lib/test/test_strptime.py
+++ b/Lib/test/test_strptime.py
@@ -506,7 +506,7 @@
self.assertTrue(result.tm_year == self.time_tuple.tm_year and
result.tm_mon == self.time_tuple.tm_mon and
result.tm_mday == self.time_tuple.tm_mday,
- "Calculation of Gregorian date failed;"
+ "Calculation of Gregorian date failed; "
"%s-%s-%s != %s-%s-%s" %
(result.tm_year, result.tm_mon, result.tm_mday,
self.time_tuple.tm_year, self.time_tuple.tm_mon,
@@ -518,7 +518,7 @@
result = _strptime._strptime_time(time.strftime(format_string, self.time_tuple),
format_string)
self.assertTrue(result.tm_wday == self.time_tuple.tm_wday,
- "Calculation of day of the week failed;"
+ "Calculation of day of the week failed; "
"%s != %s" % (result.tm_wday, self.time_tuple.tm_wday))
if support.is_android: