jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/814275 )
Change subject: [bugfix] Update TestThankRevisionErrors.test_invalid_revision test ......................................................................
[bugfix] Update TestThankRevisionErrors.test_invalid_revision test
Also use subTests for all revids
Bug: T313137 Change-Id: Ib0ac464e4c456361d09517b12cd05fc84e3f8feb --- M tests/thanks_tests.py 1 file changed, 11 insertions(+), 4 deletions(-)
Approvals: JJMC89: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/thanks_tests.py b/tests/thanks_tests.py index 137d1e0..c670392 100755 --- a/tests/thanks_tests.py +++ b/tests/thanks_tests.py @@ -103,11 +103,18 @@ def test_invalid_revision(self): """Test that passing an invalid revision ID causes an error.""" site = self.get_site() - invalid_revids = (0, -1, 0.99, 'zero, minus one, and point nine nine', - (0, -1, 0.99), [0, -1, 0.99]) + invalid_revids = (0.99, (0, -1), (0, -1, 0.99,), [0, -1, 0.99], 'zero', + 'minus one, and point nine nine') + code = 'invalidrevision' if site.mw_version < '1.35' else 'badinteger' for invalid_revid in invalid_revids: - self.assertAPIError('invalidrevision', None, site.thank_revision, - invalid_revid, source='pywikibot test') + with self.subTest(revids=invalid_revid): + self.assertAPIError(code, None, site.thank_revision, + invalid_revid, source='pywikibot test') + for invalid_revid in [0, -1, [0], [-1]]: + with self.subTest(revids=invalid_revid): + self.assertAPIError('invalidrevision', None, + site.thank_revision, invalid_revid, + source='pywikibot test')
if __name__ == '__main__': # pragma: no cover
pywikibot-commits@lists.wikimedia.org