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

Change subject: Use flake8-no-u-prefixed-strings to prevent usage of u-prefixed 
strings
......................................................................

Use flake8-no-u-prefixed-strings to prevent usage of u-prefixed strings

Fix the remaining issues.

Change-Id: I9df7b557914e23a38d9199db03440419c22dfd50
---
M setup.py
M tests/category_tests.py
M tests/i18n_tests.py
M tests/link_tests.py
M tests/namespace_tests.py
M tests/page_tests.py
M tests/reflinks_tests.py
7 files changed, 11 insertions(+), 10 deletions(-)

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



diff --git a/setup.py b/setup.py
index 6711e95..6de8817 100644
--- a/setup.py
+++ b/setup.py
@@ -75,6 +75,7 @@
         'flake8-quotes',
         'flake8-string-format',
         'flake8-tuple>=0.2.8',
+        'flake8-no-u-prefixed-strings>=0.2',
         'pep8-naming>=0.7',
         'pyflakes>=1.1',
     ]
diff --git a/tests/category_tests.py b/tests/category_tests.py
index 0d6bc5c..413f8b7 100644
--- a/tests/category_tests.py
+++ b/tests/category_tests.py
@@ -18,7 +18,7 @@

     """Test Category object."""

-    NOCATEGORYNAMESPACE_RE = '\'(.*?)\' is not in the category namespace!'
+    NOCATEGORYNAMESPACE_RE = "'(.*?)' is not in the category namespace!"
     NOREDIRECTPAGE_RE = r'Page \[\[(.*?)\]\] is not a redirect page.'

     family = 'wikipedia'
@@ -163,7 +163,7 @@

     """Test the category object with dry tests."""

-    NOCATEGORYNAMESPACE_RE = '\'(.*?)\' is not in the category namespace!'
+    NOCATEGORYNAMESPACE_RE = "'(.*?)' is not in the category namespace!"

     family = 'wikipedia'
     code = 'en'
diff --git a/tests/i18n_tests.py b/tests/i18n_tests.py
index 0bad4ee..f20c805 100644
--- a/tests/i18n_tests.py
+++ b/tests/i18n_tests.py
@@ -254,7 +254,7 @@
         self.assertEqual(
             i18n.twntranslate('de', 'test-multiple-plurals', 2)
             % {'action': 'Ändere', 'line': 'zwei'},
-            u'Bot: Ändere zwei Zeilen von mehreren Seiten.')
+            'Bot: Ändere zwei Zeilen von mehreren Seiten.')
         self.assertEqual(
             i18n.twntranslate('de', 'test-multiple-plurals', 3)
             % {'action': 'Ändere', 'line': 'drei'},
diff --git a/tests/link_tests.py b/tests/link_tests.py
index 2e22a5b..b93bb15 100644
--- a/tests/link_tests.py
+++ b/tests/link_tests.py
@@ -71,11 +71,11 @@
         """Test that valid titles are correctly normalized."""
         self.assertEqual(Link('Sandbox', self.get_site()).title, 'Sandbox')
         self.assertEqual(Link('A "B"', self.get_site()).title, 'A "B"')
-        self.assertEqual(Link('A \'B\'', self.get_site()).title, 'A \'B\'')
+        self.assertEqual(Link("A 'B'", self.get_site()).title, "A 'B'")
         self.assertEqual(Link('.com', self.get_site()).title, '.com')
         self.assertEqual(Link('~', self.get_site()).title, '~')
         self.assertEqual(Link('"', self.get_site()).title, '"')
-        self.assertEqual(Link('\'', self.get_site()).title, '\'')
+        self.assertEqual(Link("'", self.get_site()).title, "'")
         self.assertEqual(Link('Talk:Sandbox', self.get_site()).title,
                          'Sandbox')
         self.assertEqual(Link('Talk:Foo:Sandbox', self.get_site()).title,
diff --git a/tests/namespace_tests.py b/tests/namespace_tests.py
index ae870f0..21c1ab8 100644
--- a/tests/namespace_tests.py
+++ b/tests/namespace_tests.py
@@ -137,7 +137,7 @@

     def testNamespaceCompare(self):
         """Test Namespace comparisons."""
-        a = Namespace(id=0, canonical_name=u'')
+        a = Namespace(id=0, canonical_name='')

         self.assertEqual(a, 0)
         self.assertEqual(a, '')
diff --git a/tests/page_tests.py b/tests/page_tests.py
index 908706f..acb37d7 100644
--- a/tests/page_tests.py
+++ b/tests/page_tests.py
@@ -346,7 +346,7 @@

         # Test not valid source.
         self.assertRaisesRegex(pywikibot.Error,
-                               'Invalid argument type \'<\\w* \'\\w*\'>\' in '
+                               r"Invalid argument type '<\w* '\w*'>' in "
                                'Page initializer: dummy',
                                pywikibot.Page, 'dummy')

@@ -1064,13 +1064,13 @@
         p1 = pywikibot.Page(site, 'User:Unicodesnowman/ProtectTest')

         p1.protect(protections={'edit': 'sysop', 'move': 'autoconfirmed'},
-                   reason=u'Pywikibot unit test')
+                   reason='Pywikibot unit test')
         self.assertEqual(p1.protection(),
                          {'edit': ('sysop', 'infinity'),
                           'move': ('autoconfirmed', 'infinity')})

         p1.protect(protections={'edit': '', 'move': ''},
-                   reason=u'Pywikibot unit test')
+                   reason='Pywikibot unit test')
         self.assertEqual(p1.protection(), {})

     def test_protect_alt(self):
diff --git a/tests/reflinks_tests.py b/tests/reflinks_tests.py
index 1d30fb3..57c1b62 100644
--- a/tests/reflinks_tests.py
+++ b/tests/reflinks_tests.py
@@ -47,7 +47,7 @@
         """Test namespaces=[] processes all namespaces."""
         gen = XmlDumpPageGenerator(
             filename=join_xml_data_path('dummy-reflinks.xml'),
-            start=u'Fake page',
+            start='Fake page',
             namespaces=[],
             site=self.get_site())
         pages = list(gen)

--
To view, visit https://gerrit.wikimedia.org/r/464097
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: I9df7b557914e23a38d9199db03440419c22dfd50
Gerrit-Change-Number: 464097
Gerrit-PatchSet: 3
Gerrit-Owner: Dalba <[email protected]>
Gerrit-Reviewer: Dalba <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: Zhuyifei1999 <[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