jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/634201 )
Change subject: "doc: updated basestring to str"
......................................................................
"doc: updated basestring to str"
Bug: T265128
Change-Id: I69410bad85e243dcf01c3bd12422f5a54fe92355
---
M tests/pagegenerators_tests.py
M tests/site_detect_tests.py
M tests/ui_tests.py
M tests/uploadscript_tests.py
M tests/wikibase_edit_tests.py
5 files changed, 8 insertions(+), 17 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index 4315832..6c5df6f 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -11,6 +11,7 @@
import sys
from contextlib import suppress
+from typing import Optional
import pywikibot
from pywikibot import pagegenerators, date
@@ -727,20 +728,17 @@
"""Test item claim filter page generator generator."""
- def _simple_claim_test(self, prop, claim, qualifiers, valid, negate=False):
+ def _simple_claim_test(self, prop: str, claim, qualifiers: Optional[dict],
+ valid: bool, negate: bool = False):
"""
Test given claim on sample (India) page.
@param prop: the property to check
- @type prop: str
@param claim: the claim the property should contain
@param qualifiers: qualifiers to check or None
- @type qualifiers: dict or None
@param valid: true if the page should be yielded by the generator,
false otherwise
- @type valid: bool
@param negate: true to swap the filters' behavior
- @type negate: bool
"""
item = pywikibot.ItemPage(self.get_repo(), 'Q668')
gen = pagegenerators.ItemClaimFilterPageGenerator([item], prop, claim,
diff --git a/tests/site_detect_tests.py b/tests/site_detect_tests.py
index 8120d7b..0868237 100644
--- a/tests/site_detect_tests.py
+++ b/tests/site_detect_tests.py
@@ -26,12 +26,11 @@
net = True
- def assertSite(self, url):
+ def assertSite(self, url: str):
"""
Assert a MediaWiki site can be loaded from the url.
@param url: Url of tested site
- @type url: str
@raises AssertionError: Site under url is not MediaWiki powered
"""
try:
@@ -39,12 +38,11 @@
except (ServerError, Timeout) as e:
self.skipTest(e)
- def assertNoSite(self, url):
+ def assertNoSite(self, url: str):
"""
Assert a url is not a MediaWiki site.
@param url: Url of tested site
- @type url: str
@raises AssertionError: Site under url is MediaWiki powered
"""
with self.assertRaises((AttributeError, ConnectionError, RuntimeError,
diff --git a/tests/ui_tests.py b/tests/ui_tests.py
index 3da675f..52cb8e4 100644
--- a/tests/ui_tests.py
+++ b/tests/ui_tests.py
@@ -69,15 +69,13 @@
"""Handler for a StringIO or BytesIO instance able to patch itself."""
- def __init__(self, name, patched_streams):
+ def __init__(self, name: str, patched_streams: dict):
"""
Create a new stream with a StringIO or BytesIO instance.
@param name: The part after 'std' (e.g. 'err').
- @type name: str
@param patched_streams: A mapping which maps the original stream to
the patched stream.
- @type patched_streams: dict
"""
self._stream = io.StringIO()
self._name = 'std{0}'.format(name)
diff --git a/tests/uploadscript_tests.py b/tests/uploadscript_tests.py
index a6ac241..9e838ca 100644
--- a/tests/uploadscript_tests.py
+++ b/tests/uploadscript_tests.py
@@ -18,13 +18,11 @@
net = False
- def match(self, value=''):
+ def match(self, value: str = '') -> int:
"""Create a match object and call get_chunk_site.
@param value: a chunk size value
- @type value: str
@return: chunk size in bytes
- @rtype: int
"""
option = '-chunked'
if value:
diff --git a/tests/wikibase_edit_tests.py b/tests/wikibase_edit_tests.py
index 0766ef8..e8ece10 100644
--- a/tests/wikibase_edit_tests.py
+++ b/tests/wikibase_edit_tests.py
@@ -207,14 +207,13 @@
user = True
write = True
- def _clean_item(self, repo, prop):
+ def _clean_item(self, repo, prop: str):
"""
Return an item without any existing claims of the given property.
@param repo: repository to fetch item from
@type: pywikibot.site.DataSite
@param prop: P-value of the property to scrub
- @type prop: str
@return: scrubbed item
@rtype: pywikibot.ItemPage
"""
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/634201
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I69410bad85e243dcf01c3bd12422f5a54fe92355
Gerrit-Change-Number: 634201
Gerrit-PatchSet: 5
Gerrit-Owner: Udoka <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits