jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/463354 )
Change subject: [cleanup] cleanup tests/[redirect_bot_tests.py-replacebot_tests.py] ......................................................................
[cleanup] cleanup tests/[redirect_bot_tests.py-replacebot_tests.py]
- use single quotes for string literals - remove preleading "u" fron strings - indentation to make sure code lines are less than 79 characters
Change-Id: Ifde117e2d27dc68ed2983c225f98e7de77d32cfd --- M tests/reflinks_tests.py M tests/replacebot_tests.py 2 files changed, 19 insertions(+), 18 deletions(-)
Approvals: Dalba: Verified jenkins-bot: Verified Xqt: Looks good to me, approved
diff --git a/tests/reflinks_tests.py b/tests/reflinks_tests.py index 15a258f..1d30fb3 100644 --- a/tests/reflinks_tests.py +++ b/tests/reflinks_tests.py @@ -40,7 +40,7 @@ namespaces=[0, 1], site=self.get_site()) pages = list(gen) - self.assertPagelistTitles(pages, (u'Fake page', u'Talk:Fake page'), + self.assertPagelistTitles(pages, ('Fake page', 'Talk:Fake page'), site=self.get_site())
def test_namespace_empty_list(self): @@ -51,7 +51,7 @@ namespaces=[], site=self.get_site()) pages = list(gen) - self.assertPagelistTitles(pages, (u'Fake page', u'Talk:Fake page'), + self.assertPagelistTitles(pages, ('Fake page', 'Talk:Fake page'), site=self.get_site())
def test_namespace_None(self): @@ -62,7 +62,7 @@ namespaces=None, site=self.get_site()) pages = list(gen) - self.assertPagelistTitles(pages, (u'Fake page', u'Talk:Fake page'), + self.assertPagelistTitles(pages, ('Fake page', 'Talk:Fake page'), site=self.get_site())
def test_namespace_string_ids(self): @@ -70,10 +70,10 @@ gen = XmlDumpPageGenerator( filename=join_xml_data_path('dummy-reflinks.xml'), start='Fake page', - namespaces=["0", "1"], + namespaces=['0', '1'], site=self.get_site()) pages = list(gen) - self.assertPagelistTitles(pages, (u'Fake page', u'Talk:Fake page'), + self.assertPagelistTitles(pages, ('Fake page', 'Talk:Fake page'), site=self.get_site())
def test_namespace_names(self): @@ -81,10 +81,10 @@ gen = XmlDumpPageGenerator( filename=join_xml_data_path('dummy-reflinks.xml'), start='Fake page', - namespaces=["Talk"], + namespaces=['Talk'], site=self.get_site()) pages = list(gen) - self.assertPagelistTitles(pages, (u'Talk:Fake page', ), + self.assertPagelistTitles(pages, ('Talk:Fake page', ), site=self.get_site())
def test_start_with_underscore(self): @@ -95,7 +95,7 @@ namespaces=[0, 1], site=self.get_site()) pages = list(gen) - self.assertPagelistTitles(pages, (u'Fake page', u'Talk:Fake page'), + self.assertPagelistTitles(pages, ('Fake page', 'Talk:Fake page'), site=self.get_site())
def test_without_start(self): @@ -106,7 +106,7 @@ namespaces=[0, 1], site=self.get_site()) pages = list(gen) - self.assertPagelistTitles(pages, (u'Fake page', u'Talk:Fake page'), + self.assertPagelistTitles(pages, ('Fake page', 'Talk:Fake page'), site=self.get_site())
def test_start_prefix(self): @@ -117,7 +117,7 @@ namespaces=[0, 1], site=self.get_site()) pages = list(gen) - self.assertPagelistTitles(pages, (u'Fake page', u'Talk:Fake page'), + self.assertPagelistTitles(pages, ('Fake page', 'Talk:Fake page'), site=self.get_site())
@@ -152,7 +152,7 @@ """Test the generator without any narrowing.""" main('-xml:' + join_xml_data_path('dummy-reflinks.xml')) gen = self.constructor_args[0] - self.assertPageTitlesCountEqual(gen, [u'Fake page', u'Talk:Fake page'], + self.assertPageTitlesCountEqual(gen, ['Fake page', 'Talk:Fake page'], site=self.get_site())
def test_xml_one_namespace(self): @@ -161,7 +161,7 @@ '-namespace:1') gen = self.constructor_args[0] pages = list(gen) - self.assertPagelistTitles(pages, [u'Talk:Fake page'], + self.assertPagelistTitles(pages, ['Talk:Fake page'], site=self.get_site())
def test_xml_multiple_namespace_ids(self): @@ -169,7 +169,7 @@ main('-xml:' + join_xml_data_path('dummy-reflinks.xml'), '-namespace:0', '-namespace:1', '-xmlstart:Fake page') gen = self.constructor_args[0] - self.assertPageTitlesCountEqual(gen, [u'Fake page', u'Talk:Fake page'], + self.assertPageTitlesCountEqual(gen, ['Fake page', 'Talk:Fake page'], site=self.get_site())
def test_xml_multiple_namespace_ids_2(self): @@ -177,7 +177,7 @@ main('-xml:' + join_xml_data_path('dummy-reflinks.xml'), '-namespace:0,1', '-xmlstart:Fake page') gen = self.constructor_args[0] - self.assertPageTitlesCountEqual(gen, [u'Fake page', u'Talk:Fake page'], + self.assertPageTitlesCountEqual(gen, ['Fake page', 'Talk:Fake page'], site=self.get_site())
def test_xml_start_prefix(self): @@ -186,7 +186,7 @@ '-namespace:1', '-xmlstart:Fake') gen = self.constructor_args[0] pages = list(gen) - self.assertPagelistTitles(pages, [u'Talk:Fake page'], + self.assertPagelistTitles(pages, ['Talk:Fake page'], site=self.get_site())
def test_xml_start_underscore(self): @@ -195,7 +195,7 @@ '-namespace:1', '-xmlstart:Fake_page') gen = self.constructor_args[0] pages = list(gen) - self.assertPagelistTitles(pages, [u'Talk:Fake page'], + self.assertPagelistTitles(pages, ['Talk:Fake page'], site=self.get_site())
def test_xml_namespace_name(self): @@ -204,7 +204,7 @@ '-namespace:Talk', '-xmlstart:Fake page') gen = self.constructor_args[0] pages = list(gen) - self.assertPagelistTitles(pages, [u'Talk:Fake page'], + self.assertPagelistTitles(pages, ['Talk:Fake page'], site=self.get_site())
diff --git a/tests/replacebot_tests.py b/tests/replacebot_tests.py index 86502c3..e203dd8 100644 --- a/tests/replacebot_tests.py +++ b/tests/replacebot_tests.py @@ -111,7 +111,8 @@ if not callable(replacement.new): self.assertEqual(replacement.new, str(offset * 2 + 2))
- def _test_fix_replacement(self, replacement, length=1, offset=0, msg=False): + def _test_fix_replacement(self, replacement, + length=1, offset=0, msg=False): """Test a replacement from a fix.""" assert length > offset self._test_replacement(replacement, replace.ReplacementListEntry,