jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/463609 )

Change subject: [cleanup] cleanup 
tests/[cache_tests.py-cosmetic_changes_tests.py]
......................................................................

[cleanup] cleanup tests/[cache_tests.py-cosmetic_changes_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: I7a192498e484521f2f7b721e71ab571b6068b14d
---
M tests/category_bot_tests.py
M tests/category_tests.py
M tests/conftest.py
M tests/cosmetic_changes_tests.py
4 files changed, 39 insertions(+), 26 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/category_bot_tests.py b/tests/category_bot_tests.py
index 84e67b5..da3d34b 100644
--- a/tests/category_bot_tests.py
+++ b/tests/category_bot_tests.py
@@ -26,25 +26,25 @@
     """Test CFD (Categories for deletion) actions."""

     def test_strip_cfd_templates_does_nothing_when_no_templates(self):
-        """Test that when there are no CFD templates, the page text is not 
changed."""
+        """Test when the're no CFD templates, the page text is not changed."""
         bot = CategoryMoveRobot(oldcat='Old', newcat='New')
-        bot.newcat.text = "Nothing should change.\n\nAnother line."
+        bot.newcat.text = 'Nothing should change.\n\nAnother line.'
         bot._strip_cfd_templates(commit=False)
         self.assertEqual(bot.newcat.text,
-                         "Nothing should change.\n\nAnother line.")
+                         'Nothing should change.\n\nAnother line.')

     def test_strip_cfd_templates_with_spaces_in_comments(self):
-        """Test that CFD templates with spaces in the syntax are removed 
properly."""
+        """Test CFD templates with spaces in the syntax are removed."""
         self._runtest_strip_cfd_templates('<!-- BEGIN CFD TEMPLATE -->',
                                           '<!-- END CFD TEMPLATE -->')

     def test_strip_cfd_templates_without_spaces_in_comments(self):
-        """Test that CFD templates without spaces in the syntax are removed 
properly."""
+        """Test CFD templates without spaces in the syntax are removed."""
         self._runtest_strip_cfd_templates('<!--BEGIN CFD TEMPLATE-->',
                                           '<!--END CFD TEMPLATE-->')

     def _runtest_strip_cfd_templates(self, template_start, template_end):
-        """Run a CFD template stripping test with the given CFD start/end 
templates."""
+        """Run a CFD template stripping test, given CFD start/end templates."""
         bot = CategoryMoveRobot(oldcat='Old', newcat='New')
         bot.newcat.text = '\n'.join((
             'Preamble',
diff --git a/tests/category_tests.py b/tests/category_tests.py
index 222fe13..0d6bc5c 100644
--- a/tests/category_tests.py
+++ b/tests/category_tests.py
@@ -36,7 +36,8 @@
         """Test if category is empty or not."""
         site = self.get_site()
         cat_empty = pywikibot.Category(site, 'Category:foooooo')
-        cat_not_empty = pywikibot.Category(site, 'Category:Wikipedia 
categories')
+        cat_not_empty = pywikibot.Category(site,
+                                           'Category:Wikipedia categories')
         self.assertTrue(cat_empty.isEmptyCategory())
         self.assertFalse(cat_not_empty.isEmptyCategory())

@@ -57,10 +58,12 @@
         self.assertTrue(categoryinfo['pages'] >= 0)
         self.assertTrue(categoryinfo['size'] > 0)
         self.assertTrue(categoryinfo['subcats'] > 0)
-        members_sum = categoryinfo['files'] + categoryinfo['pages'] + 
categoryinfo['subcats']
+        members_sum = (categoryinfo['files'] + categoryinfo['pages']
+                       + categoryinfo['subcats'])
         self.assertEqual(members_sum, categoryinfo['size'])

-        cat_files = pywikibot.Category(site, 'Category:Files lacking an 
author')
+        cat_files = pywikibot.Category(site,
+                                       'Category:Files lacking an author')
         categoryinfo2 = cat_files.categoryinfo
         self.assertTrue(categoryinfo2['files'] > 0)

@@ -152,7 +155,8 @@

         # Raise exception if target is fetched for non Category redirects.
         self.assertRaisesRegex(pywikibot.IsNotRedirectPage,
-                               self.NOREDIRECTPAGE_RE, 
cat2.getCategoryRedirectTarget)
+                               self.NOREDIRECTPAGE_RE,
+                               cat2.getCategoryRedirectTarget)


 class TestCategoryDryObject(TestCase):
@@ -222,20 +226,23 @@
         site = self.get_site()
         cat = pywikibot.Category(site, 'Category:Wikipedia Categories')
         self.assertEqual(cat.title(as_link=True, insite=cat.site),
-                         u'[[Category:Wikipedia Categories]]')
-        cat_section = pywikibot.Category(site, 'Category:Wikipedia 
Categories#Foo')
+                         '[[Category:Wikipedia Categories]]')
+        cat_section = pywikibot.Category(site,
+                                         'Category:Wikipedia Categories#Foo')
         self.assertEqual(
             cat_section.title(as_link=True, insite=cat_section.site),
             '[[Category:Wikipedia Categories#Foo]]')
         cat_dup = pywikibot.Category(site, 'Category:Wikipedia:Test')
         self.assertEqual(cat_dup.title(as_link=True, insite=cat_dup.site),
-                         u'[[Category:Wikipedia:Test]]')
+                         '[[Category:Wikipedia:Test]]')

     def test_sortkey(self):
         """Test the sortKey attribute."""
         site = self.get_site()
-        cat = pywikibot.Category(site, 'Category:Wikipedia categories', 
'Example')
-        self.assertEqual(cat.aslink(), '[[Category:Wikipedia 
categories|Example]]')
+        cat = pywikibot.Category(site, 'Category:Wikipedia categories',
+                                 'Example')
+        self.assertEqual(cat.aslink(),
+                         '[[Category:Wikipedia categories|Example]]')
         self.assertEqual(cat.aslink(sort_key='Foo'),
                          '[[Category:Wikipedia categories|Foo]]')

@@ -251,7 +258,7 @@

     def test_newest_pages(self):
         """Test that the pages are getting older."""
-        cat = pywikibot.Category(self.get_site(), u'Catégorie:Yukon Quest 
2015')
+        cat = pywikibot.Category(self.get_site(), 'Catégorie:Yukon Quest 2015')
         last = pywikibot.Timestamp.max
         count = 0
         for page in cat.newest_pages():
diff --git a/tests/conftest.py b/tests/conftest.py
index 0af46cf..cbaa39a 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -11,5 +11,5 @@


 def pytest_configure(config):
-    """Set the sys._test_runner_pytest flag to True, if pytest is used to run 
tests."""
+    """Set the sys._test_runner_pytest flag to True, if pytest is used."""
     sys._test_runner_pytest = True
diff --git a/tests/cosmetic_changes_tests.py b/tests/cosmetic_changes_tests.py
index f038733..bf56944 100644
--- a/tests/cosmetic_changes_tests.py
+++ b/tests/cosmetic_changes_tests.py
@@ -60,7 +60,8 @@
         """Test resolveHtmlEntities method."""
         self.assertEqual(
             '&amp;#&nbsp;# #0#&#62;#x',
-            
self.cct.resolveHtmlEntities('&amp;#&nbsp;#&#32;#&#48;#&#62;#&#120;'))
+            self.cct.resolveHtmlEntities(
+                '&amp;#&nbsp;#&#32;#&#48;#&#62;#&#120;'))
         self.assertEqual(
             '<code>&#32;</code>',
             self.cct.resolveHtmlEntities('<code>&#32;</code>'))
@@ -213,13 +214,17 @@
             '[[:Datei:Example.svg|Description]]\n',
             self.cct.fixSyntaxSave(
                 '[https://de.wikipedia.org/wiki/Kategorie:Example]\n'
-                '[https://de.wikipedia.org/wiki/Category:Example 
Description]\n'
+                '[https://de.wikipedia.org/wiki/Category:Example '
+                'Description]\n'
                 '[https://de.wikipedia.org/wiki/Datei:Example.svg]\n'
-                '[https://de.wikipedia.org/wiki/File:Example.svg 
Description]\n'
+                '[https://de.wikipedia.org/wiki/File:Example.svg '
+                'Description]\n'
                 '[[https://de.wikipedia.org/wiki/Category:Example]]\n'
-                '[[https://de.wikipedia.org/wiki/Kategorie:Example 
Description]]\n'
+                '[[https://de.wikipedia.org/wiki/Kategorie:Example '
+                'Description]]\n'
                 '[[https://de.wikipedia.org/wiki/File:Example.svg]]\n'
-                '[[https://de.wikipedia.org/wiki/Datei:Example.svg 
Description]]\n'
+                '[[https://de.wikipedia.org/wiki/Datei:Example.svg '
+                'Description]]\n'
             ))
         del self.cct.site._namespaces

@@ -438,8 +443,8 @@
         """
         Test cleanUpLinks method.

-        This method fails for the given samples from library. Either the method
-        has to be changed or the examples must be fixed.
+        This method fails for the given samples from library. Either
+        the method has to be changed or the examples must be fixed.
         """
         self.assertEqual('text [[title]] text',
                          self.cct.cleanUpLinks('text[[ title ]]text'))
@@ -454,8 +459,9 @@
         """Test replaceDeprecatedTemplates method."""
         self.assertEqual('{{Belege fehlen}}',
                          self.cct.replaceDeprecatedTemplates('{{Belege}}'))
-        self.assertEqual('{{Belege fehlen|Test}}',
-                         
self.cct.replaceDeprecatedTemplates('{{Quelle|Test}}'))
+        self.assertEqual(
+            '{{Belege fehlen|Test}}',
+            self.cct.replaceDeprecatedTemplates('{{Quelle|Test}}'))


 class TestCosmeticChangesPersian(TestCosmeticChanges):

--
To view, visit https://gerrit.wikimedia.org/r/463609
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I7a192498e484521f2f7b721e71ab571b6068b14d
Gerrit-Change-Number: 463609
Gerrit-PatchSet: 3
Gerrit-Owner: D3r1ck01 <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot (75)
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to