jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/346092 )
Change subject: page_tests.py: Use raw string notation for regular expressions ......................................................................
page_tests.py: Use raw string notation for regular expressions
Python 3.6 issues "DeprecationWarning: invalid escape sequence" for using "." in normal string literals.
Change-Id: Ic5c3069e9cc04a17d44ead417219c75bdb61808c --- M tests/page_tests.py 1 file changed, 5 insertions(+), 5 deletions(-)
Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved
diff --git a/tests/page_tests.py b/tests/page_tests.py index 44b561a..3090f4d 100644 --- a/tests/page_tests.py +++ b/tests/page_tests.py @@ -37,9 +37,9 @@ )
-EMPTY_TITLE_RE = 'Title must be specified and not empty if source is a Site.' -INVALID_TITLE_RE = 'The link does not contain a page title' -NO_PAGE_RE = 'doesn't exist.' +EMPTY_TITLE_RE = r'Title must be specified and not empty if source is a Site.' +INVALID_TITLE_RE = r'The link does not contain a page title' +NO_PAGE_RE = r"doesn't exist."
class TestLinkObject(SiteAttributeTestCase): @@ -856,7 +856,7 @@ text = u'This page is used in the [[mw:Manual:Pywikipediabot]] testing suite.' self.assertEqual(p1.get(), text) self.assertRaisesRegex(pywikibot.exceptions.IsRedirectPage, - '{0} is a redirect page.' + r'{0} is a redirect page.' .format(re.escape(str(p2))), p2.get) self.assertRaisesRegex(pywikibot.exceptions.NoPage, NO_PAGE_RE, p3.get)
@@ -870,7 +870,7 @@
text = p2.get(get_redirect=True) self.assertRaisesRegex(pywikibot.exceptions.IsNotRedirectPage, - '{0} is not a redirect page.' + r'{0} is not a redirect page.' .format(re.escape(str(p1))), p1.set_redirect_target, p2) self.assertRaisesRegex(pywikibot.exceptions.NoPage, NO_PAGE_RE,
pywikibot-commits@lists.wikimedia.org