jenkins-bot has submitted this change and it was merged.
Change subject: pep8: fix up various whitespaces
......................................................................
pep8: fix up various whitespaces
This clear out trailing whitespaces, adds double newlines before class
definition and some other trivial spaces changes.
Change-Id: I78c509575cbf6616e86308a1df89280b116aa39e
---
M pwb.py
M scripts/tests/test_data_ingestion.py
M tests/__init__.py
M tests/i18n/test.py
M tests/textlib_tests.py
M tests/ui_tests.py
M tests/utils.py
M tests/wikibase_tests.py
8 files changed, 28 insertions(+), 23 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pwb.py b/pwb.py
index 6d58bbf..532272a 100644
--- a/pwb.py
+++ b/pwb.py
@@ -32,7 +32,7 @@
if "PYWIKIBOT2_DIR" not in os.environ:
os.environ["PYWIKIBOT2_DIR"] = os.path.split(__file__)[0]
-for i,x in enumerate(sys.argv):
+for i, x in enumerate(sys.argv):
if x.startswith("-dir:"):
os.environ["PYWIKIBOT2_DIR"] = x[5:]
sys.argv.pop(i)
diff --git a/scripts/tests/test_data_ingestion.py b/scripts/tests/test_data_ingestion.py
index 568a6aa..4ab2cb9 100644
--- a/scripts/tests/test_data_ingestion.py
+++ b/scripts/tests/test_data_ingestion.py
@@ -12,9 +12,10 @@
import data_ingestion
+
class TestPhoto(unittest.TestCase):
def setUp(self):
- self.obj =
data_ingestion.Photo(URL='http://upload.wikimedia.org/wikipedia/commons…png',
+ self.obj =
data_ingestion.Photo(URL='http://upload.wikimedia.org/wikipedia/commons…png',
metadata={'description.en':
'"Sounds" icon',
'source':
'http://commons.wikimedia.org/wiki/File:Sound-icon.svg',
'author': 'KDE artists |
Silstor',
diff --git a/tests/__init__.py b/tests/__init__.py
index e0c4f27..92b921d 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -24,6 +24,7 @@
def _expired(self, dt):
return False
+
def patch_request():
pywikibot.data.api.Request = TestRequest
diff --git a/tests/i18n/test.py b/tests/i18n/test.py
index a1115fb..f93769a 100644
--- a/tests/i18n/test.py
+++ b/tests/i18n/test.py
@@ -1,12 +1,12 @@
# -*- coding=utf-8 -*-
msg = {
- 'en': {'test-localized': u'test-localized EN',
- 'test-semi-localized': u'test-semi-localized EN',
- 'test-non-localized': u'test-non-localized EN'
- },
- 'nl': {'test-localized': u'test-localized NL',
- 'test-semi-localized': u'test-semi-localized NL',
- },
- 'fy': {'test-localized': u'test-localized FY'},
- 'ja': {'test-no-english': u'test-no-english JA'}
- }
+ 'en': {'test-localized': u'test-localized EN',
+ 'test-semi-localized': u'test-semi-localized EN',
+ 'test-non-localized': u'test-non-localized EN'
+ },
+ 'nl': {'test-localized': u'test-localized NL',
+ 'test-semi-localized': u'test-semi-localized NL',
+ },
+ 'fy': {'test-localized': u'test-localized FY'},
+ 'ja': {'test-no-english': u'test-no-english JA'}
+ }
diff --git a/tests/textlib_tests.py b/tests/textlib_tests.py
index 5a4d3f5..3f504c0 100644
--- a/tests/textlib_tests.py
+++ b/tests/textlib_tests.py
@@ -23,10 +23,11 @@
for f in ["enwiki_help_editing"]:
files[f] = codecs.open(os.path.join(dirname, f + ".page"), 'r',
'utf-8').read()
+
class TestSectionFunctions(unittest.TestCase):
def contains(self, fn, sn):
return textlib.does_text_contain_section(
- files[fn], sn)
+ files[fn], sn)
def assertContains(self, fn, sn, *args, **kwargs):
self.assertEqual(self.contains(fn, sn), True, *args, **kwargs)
diff --git a/tests/ui_tests.py b/tests/ui_tests.py
index 38a1d0f..d4ba066 100644
--- a/tests/ui_tests.py
+++ b/tests/ui_tests.py
@@ -49,7 +49,7 @@
def set_ui(self, key, value):
import pywikibot
setattr(pywikibot.ui, key, value)
-
+
def cls(self):
os.system('cls')
@@ -101,15 +101,15 @@
newstdout.truncate(0)
newstderr.truncate(0)
newstdin.truncate(0)
-
+
pywikibot.config.colorized_output = True
pywikibot.config.transliterate = False
pywikibot.ui.transliteration_target = None
pywikibot.ui.encoding = 'utf-8'
def tearDown(self):
- unpatch()
-
+ unpatch()
+
class TestTerminalOutput(UITestCase):
def testOutputLevels_logging_debug(self):
logger.log(DEBUG, 'debug', extra=loggingcontext)
@@ -269,7 +269,7 @@
returned = pywikibot.inputChoice("question", ["answer 1",
"answer 2", "answer 3"], ["A", "N",
"S"], "A")
self.assertEqual(newstdout.getvalue(), "")
- self.assertEqual(newstderr.getvalue(), "question ([A]nswer 1, a[N]swer
2, an[S]wer 3) "*2)
+ self.assertEqual(newstderr.getvalue(), "question ([A]nswer 1, a[N]swer
2, an[S]wer 3) " * 2)
self.assertIsInstance(returned, unicode)
self.assertEqual(returned, "n")
@@ -325,7 +325,7 @@
pywikibot.config.transliterate = True
pywikibot.output(u"abcd АБГД αβγδ あいうえお")
self.assertEqual(newstdout.getvalue(), "")
- self.assertEqual(newstderr.getvalue(), "abcd
\x1b[33;1mA\x1b[0m\x1b[33;1mB\x1b[0m\x1b[33;1mG\x1b[0m\x1b[33;1mD\x1b[0m
\x1b[33;1ma\x1b[0m\x1b[33;1mb\x1b[0m\x1b[33;1mg\x1b[0m\x1b[33;1md\x1b[0m
\x1b[33;1ma\x1b[0m\x1b[33;1mi\x1b[0m\x1b[33;1mu\x1b[0m\x1b[33;1me\x1b[0m\x1b[33;1mo\x1b[0m\n\x1b[0m")
# noqa
+ self.assertEqual(newstderr.getvalue(), "abcd
\x1b[33;1mA\x1b[0m\x1b[33;1mB\x1b[0m\x1b[33;1mG\x1b[0m\x1b[33;1mD\x1b[0m
\x1b[33;1ma\x1b[0m\x1b[33;1mb\x1b[0m\x1b[33;1mg\x1b[0m\x1b[33;1md\x1b[0m
\x1b[33;1ma\x1b[0m\x1b[33;1mi\x1b[0m\x1b[33;1mu\x1b[0m\x1b[33;1me\x1b[0m\x1b[33;1mo\x1b[0m\n\x1b[0m")
# noqa
@unittest.skipUnless(os.name == "nt", "requires Windows
console")
class TestWindowsTerminalUnicode(UITestCase):
@@ -341,7 +341,7 @@
creationflags=subprocess.CREATE_NEW_CONSOLE)
_manager.connect()
cls.pywikibot = _manager.pywikibot()
-
+
cls._app = pywinauto.application.Application()
cls._app.connect_(process=cls._process.pid)
@@ -380,13 +380,13 @@
def setUp(self):
super(TestWindowsTerminalUnicode, self).setUp()
-
+
self.pywikibot.set_config('colorized_output', True)
self.pywikibot.set_config('transliterate', False)
self.pywikibot.set_config('console_encoding', 'utf-8')
self.pywikibot.set_ui('transliteration_target', None)
self.pywikibot.set_ui('encoding', 'utf-8')
-
+
self.pywikibot.cls()
self.setclip(u'')
diff --git a/tests/utils.py b/tests/utils.py
index 77f0d75..2aa8307 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -1,6 +1,7 @@
import unittest
+
class PywikibotTestCase(unittest.TestCase):
def assertType(self, obj, cls):
"""Assert that obj is an instance of type cls"""
- return self.assertTrue(isinstance(obj, cls))
\ No newline at end of file
+ return self.assertTrue(isinstance(obj, cls))
diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index 5caaabf..878de0a 100644
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -20,6 +20,7 @@
mainpage = pywikibot.Page(pywikibot.page.Link("Main Page", site))
wikidata = site.data_repository()
+
class TestGeneral(PywikibotTestCase):
def testWikibase(self):
if not site.has_transcluded_data:
--
To view, visit
https://gerrit.wikimedia.org/r/81377
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I78c509575cbf6616e86308a1df89280b116aa39e
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Hashar <hashar(a)free.fr>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot