jenkins-bot merged this change.

View Change

Approvals: Xqt: Looks good to me, but someone else must approve Dvorapa: Looks good to me, approved jenkins-bot: Verified
[PEP8] Fix W504 errors in pywikibot/tests

Fixed the W504 error occurrences in the following files:
- tests/__init__.py
- tests/pagegenerators_tests.py
- tests/site_tests.py
- tests/tools_ip_tests.py
- tests/ui_tests.py
- tests/utils.py

Bug: T207836
Change-Id: I2798e003f9b2948e0301f5345a4aadba60d4ecc8
---
M tests/__init__.py
M tests/pagegenerators_tests.py
M tests/site_tests.py
M tests/tools_ip_tests.py
M tests/ui_tests.py
M tests/utils.py
6 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/tests/__init__.py b/tests/__init__.py
index d120baf..7bddc15 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -232,9 +232,9 @@
for test_func in cls:
if test_func._testMethodName not in disabled_tests[module]:
enabled_tests.append(
- module_class_name + '.' +
- test_func.__class__.__name__ + '.' +
- test_func._testMethodName)
+ module_class_name + '.'
+ + test_func.__class__.__name__ + '.'
+ + test_func._testMethodName)

test_list.extend(enabled_tests)
else:
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index 03875f5..e72d625 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -461,8 +461,8 @@
"""Test YearPageGenerator."""
site = self.get_site()
# Some languages are missing (T85681)
- if ((site.lang not in date.formats['YearBC']) or
- (site.lang not in date.formats['YearAD'])):
+ if (site.lang not in date.formats['YearBC']
+ or site.lang not in date.formats['YearAD']):
raise unittest.SkipTest(
'Date formats for this language are missing from date.py')
start = -20
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 7f6056b..5d2c369 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -699,8 +699,8 @@
for page in mysite.allpages(maxsize=200, total=5):
self.assertIsInstance(page, pywikibot.Page)
self.assertTrue(page.exists())
- if (len(page.text.encode(mysite.encoding())) > 200 and
- mysite.data_repository() == mysite):
+ if (len(page.text.encode(mysite.encoding())) > 200
+ and mysite.data_repository() == mysite):
unittest_print(
'{}.text is > 200 bytes while raw JSON is <= 200'
.format(page))
diff --git a/tests/tools_ip_tests.py b/tests/tools_ip_tests.py
index da4c1b3..e53a611 100644
--- a/tests/tools_ip_tests.py
+++ b/tests/tools_ip_tests.py
@@ -700,15 +700,15 @@
self._run_tests()
self.assertEqual(self.fail, 0)

- @expected_failure_if(ip.ip_address.__module__ == 'ipaddress' or
- ip.ip_address.__name__ == 'ip_address_patched')
+ @expected_failure_if(ip.ip_address.__module__ == 'ipaddress'
+ or ip.ip_address.__name__ == 'ip_address_patched')
def test_T76286_failures(self):
"""Test known bugs in the ipaddress module."""
self._test_T76286_failures()
self.assertEqual(self.fail, 0)

- @expected_failure_if(ip.ip_address.__module__ == 'ipaddr' and
- ip._ipaddr_version == StrictVersion('2.1.10'))
+ @expected_failure_if(ip.ip_address.__module__ == 'ipaddr'
+ and ip._ipaddr_version == StrictVersion('2.1.10'))
def test_T105443_failures(self):
"""Test known bugs in the ipaddr module."""
self._test_T105443_failures()
diff --git a/tests/ui_tests.py b/tests/ui_tests.py
index 09d1cc0..1fbe330 100644
--- a/tests/ui_tests.py
+++ b/tests/ui_tests.py
@@ -455,8 +455,8 @@
newstderr.getvalue(),
'text light purple text text ***\n')

- str2 = ('normal text \03{lightpurple} light purple ' +
- '\03{lightblue} light blue \03{previous} light purple ' +
+ str2 = ('normal text \03{lightpurple} light purple '
+ '\03{lightblue} light blue \03{previous} light purple '
'\03{default} normal text')

def testOutputColorCascade_incorrect(self):
@@ -465,8 +465,8 @@
self.assertEqual(newstdout.getvalue(), '')
self.assertEqual(
newstderr.getvalue(),
- 'normal text \x1b[95m light purple ' +
- '\x1b[94m light blue \x1b[95m light purple ' +
+ 'normal text \x1b[95m light purple '
+ '\x1b[94m light blue \x1b[95m light purple '
'\x1b[0m normal text\n')


diff --git a/tests/utils.py b/tests/utils.py
index dfd32a2..4036155 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -680,15 +680,15 @@
# Generate a more informative error
if OSWIN32 and PY2:
unicode_env = [(k, v) for k, v in os.environ.items()
- if not isinstance(k, str) or
- not isinstance(v, str)]
+ if not isinstance(k, str)
+ or not isinstance(v, str)]
if unicode_env:
raise TypeError(
'{}: unicode in os.environ: {!r}'.format(e, unicode_env))

child_unicode_env = [(k, v) for k, v in env.items()
- if not isinstance(k, str) or
- not isinstance(v, str)]
+ if not isinstance(k, str)
+ or not isinstance(v, str)]
if child_unicode_env:
raise TypeError(
'{}: unicode in child env: {!r}'

To view, visit change 474527. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I2798e003f9b2948e0301f5345a4aadba60d4ecc8
Gerrit-Change-Number: 474527
Gerrit-PatchSet: 2
Gerrit-Owner: Nathan fraignt <nathanklumpenaar10@outlook.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick@gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: Framawiki <framawiki@tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot (75)