jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/350218 )
Change subject: Fix invalid escape sequences ......................................................................
Fix invalid escape sequences
These sequences raise DeprecationWarning in Python 3.6.
Keep lines under 80 characters.
Change-Id: I3e42d84ded34e2fa41f610371701d35e86532731 --- M tests/api_tests.py M tests/deprecation_tests.py M tests/family_tests.py M tests/http_tests.py 4 files changed, 16 insertions(+), 9 deletions(-)
Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved
diff --git a/tests/api_tests.py b/tests/api_tests.py index 6c2437a..9036102 100644 --- a/tests/api_tests.py +++ b/tests/api_tests.py @@ -623,7 +623,7 @@ """Test setting the limit to not a number.""" with self.assertRaisesRegex( ValueError, - "invalid literal for int() with base 10: 'test'"): + r"invalid literal for int() with base 10: 'test'"): self.gen.set_maximum_items('test')
def test_limit_equal_total(self): diff --git a/tests/deprecation_tests.py b/tests/deprecation_tests.py index dfee80b..49b7465 100644 --- a/tests/deprecation_tests.py +++ b/tests/deprecation_tests.py @@ -605,8 +605,11 @@ """Test invalid @remove_last_args on functions.""" self.assertRaisesRegex( TypeError, - r"(deprecated_all2() missing 1 required positional argument: 'foo'|" # Python 3 - "deprecated_all2() takes exactly 1 argument (0 given))", # Python 2 + # Python 3 + r"(deprecated_all2() missing 1 required positional argument: " + r"'foo'|" + # Python 2 + r"deprecated_all2() takes exactly 1 argument (0 given))", deprecated_all2)
self.assertRaisesRegex( @@ -618,7 +621,7 @@ self.assertRaisesRegex( TypeError, r'deprecated_all2() takes (exactly )?1 (positional )?argument' - ' (but 2 were given|(2 given))', + r' (but 2 were given|(2 given))', deprecated_all2, 1, 2, 3)
@@ -626,8 +629,11 @@
self.assertRaisesRegex( TypeError, - r"(deprecated_all2() missing 1 required positional argument: 'foo'|" # Python 3 - "deprecated_all2() takes exactly 2 arguments (1 given))", # Python 2 + # Python 3 + r"(deprecated_all2() missing 1 required positional argument: " + r"'foo'|" + # Python 2 + r"deprecated_all2() takes exactly 2 arguments (1 given))", f.deprecated_all2)
self.assertRaisesRegex( @@ -639,7 +645,7 @@ self.assertRaisesRegex( TypeError, r'deprecated_all2() takes (exactly )?2 (positional )?arguments ' - '(but 3 were given|(3 given))', + r'(but 3 were given|(3 given))', f.deprecated_all2, 1, 2, 3)
diff --git a/tests/family_tests.py b/tests/family_tests.py index 97778df..f619c10 100644 --- a/tests/family_tests.py +++ b/tests/family_tests.py @@ -211,7 +211,7 @@ # Text after $1 is not allowed self.assertRaisesRegex( ValueError, - 'Text after the $1 placeholder is not supported (T111513)', + r'Text after the $1 placeholder is not supported (T111513)', f.from_url, '//vo.wikipedia.org/wiki/$1/foo')
diff --git a/tests/http_tests.py b/tests/http_tests.py index 1d730b0..b590ad7 100644 --- a/tests/http_tests.py +++ b/tests/http_tests.py @@ -179,7 +179,8 @@
def test_http_504(self): """Test that a HTTP 504 raises the correct exception.""" - self.assertRaisesRegex(pywikibot.Server504Error, 'Server ([^:]+|[^:]+:[0-9]+) timed out', + self.assertRaisesRegex(pywikibot.Server504Error, + r'Server ([^:]+|[^:]+:[0-9]+) timed out', http.fetch, uri=self.get_httpbin_url('/status/504'))
pywikibot-commits@lists.wikimedia.org