Xqt submitted this change.

View Change


Approvals: Xqt: Verified; Looks good to me, approved
[tests] Add subtests to TestUserContribsWithoutUser.test_user_prefix

Change-Id: Ia7d8e52b64fb5dc0994b95fcbb6290b9dcc3cd5a
---
M tests/site_generators_tests.py
1 file changed, 28 insertions(+), 16 deletions(-)

diff --git a/tests/site_generators_tests.py b/tests/site_generators_tests.py
index 2f5a68a..2f5888a 100755
--- a/tests/site_generators_tests.py
+++ b/tests/site_generators_tests.py
@@ -1183,27 +1183,30 @@
"""Test the site.usercontribs() method."""
mysite = self.get_site()
start = '2008-10-06T01:02:03Z'
- for contrib in mysite.usercontribs(
- userprefix='Jane',
- start=pywikibot.Timestamp.fromISOformat(start),
- total=5):
- self.assertLessEqual(contrib['timestamp'], start)
+ with self.subTest(start=start):
+ for contrib in mysite.usercontribs(
+ userprefix='Jane',
+ start=pywikibot.Timestamp.fromISOformat(start),
+ total=5):
+ self.assertLessEqual(contrib['timestamp'], start)

end = '2008-10-07T02:03:04Z'
- for contrib in mysite.usercontribs(
- userprefix='Jane',
- end=pywikibot.Timestamp.fromISOformat(end),
- total=5):
- self.assertGreaterEqual(contrib['timestamp'], end)
+ with self.subTest(end=end):
+ for contrib in mysite.usercontribs(
+ userprefix='Jane',
+ end=pywikibot.Timestamp.fromISOformat(end),
+ total=5):
+ self.assertGreaterEqual(contrib['timestamp'], end)

start = '2008-10-10T11:59:59Z'
end = '2008-10-10T00:00:01Z'
- for contrib in mysite.usercontribs(
- userprefix='Timshiel',
- start=pywikibot.Timestamp.fromISOformat(start),
- end=pywikibot.Timestamp.fromISOformat(end),
- total=5):
- self.assertTrue(end <= contrib['timestamp'] <= start)
+ with self.subTest(start=start, end=end):
+ for contrib in mysite.usercontribs(
+ userprefix='Timshiel',
+ start=pywikibot.Timestamp.fromISOformat(start),
+ end=pywikibot.Timestamp.fromISOformat(end),
+ total=5):
+ self.assertTrue(end <= contrib['timestamp'] <= start)

def test_user_prefix_reverse(self):
"""Test the site.usercontribs() method with range reversed."""

To view, visit change 911775. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ia7d8e52b64fb5dc0994b95fcbb6290b9dcc3cd5a
Gerrit-Change-Number: 911775
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged