jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/538570 )

Change subject: [tests] Test for AssertionError instead of pywikibot.Error
......................................................................

[tests] Test for AssertionError instead of pywikibot.Error

Exception of assert_valid_iter_params  has been changed from
AssertionError to pywikibot.Error recently. Fix tests accordingly.

Bug: T233582
Change-Id: Ib260d6b3e2ced977d1e4757abb71852f695fc52e
---
M tests/site_tests.py
1 file changed, 14 insertions(+), 14 deletions(-)

Approvals:
  Mpaa: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/site_tests.py b/tests/site_tests.py
index 6bc862f..d4bf58c 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -943,13 +943,13 @@
             for prop in props:
                 self.assertIn(prop, block)
         # starttime earlier than endtime
-        self.assertRaises(pywikibot.Error, mysite.blocks, total=5,
+        self.assertRaises(AssertionError, mysite.blocks, total=5,
                           starttime=pywikibot.Timestamp.fromISOformat(
                               '2008-08-03T00:00:01Z'),
                           endtime=pywikibot.Timestamp.fromISOformat(
                               '2008-08-03T23:59:59Z'))
         # reverse: endtime earlier than starttime
-        self.assertRaises(pywikibot.Error, mysite.blocks,
+        self.assertRaises(AssertionError, mysite.blocks,
                           starttime=pywikibot.Timestamp.fromISOformat(
                               '2008-08-03T23:59:59Z'),
                           endtime=pywikibot.Timestamp.fromISOformat(
@@ -1335,13 +1335,13 @@
                 '2008-02-03T00:00:01Z' <= str(entry.timestamp())
                 <= '2008-02-03T23:59:59Z')
         # starttime earlier than endtime
-        self.assertRaises(pywikibot.Error, mysite.logevents,
+        self.assertRaises(AssertionError, mysite.logevents,
                           start=pywikibot.Timestamp.fromISOformat(
                               '2008-02-03T00:00:01Z'),
                           end=pywikibot.Timestamp.fromISOformat(
                               '2008-02-03T23:59:59Z'), total=5)
         # reverse: endtime earlier than starttime
-        self.assertRaises(pywikibot.Error, mysite.logevents,
+        self.assertRaises(AssertionError, mysite.logevents,
                           start=pywikibot.Timestamp.fromISOformat(
                               '2008-02-03T23:59:59Z'),
                           end=pywikibot.Timestamp.fromISOformat(
@@ -1465,11 +1465,11 @@
                 '2008-10-05T06:00:01Z' <= change['timestamp']
                 <= '2008-10-05T23:59:59Z')
         # start earlier than end
-        self.assertRaises(pywikibot.Error, mysite.recentchanges,
+        self.assertRaises(AssertionError, mysite.recentchanges,
                           start='2008-02-03T00:00:01Z',
                           end='2008-02-03T23:59:59Z', total=5)
         # reverse: end earlier than start
-        self.assertRaises(pywikibot.Error, mysite.recentchanges,
+        self.assertRaises(AssertionError, mysite.recentchanges,
                           start=pywikibot.Timestamp.fromISOformat(
                               '2008-02-03T23:59:59Z'),
                           end=pywikibot.Timestamp.fromISOformat(
@@ -1777,12 +1777,12 @@
         """Test the site.usercontribs() method with invalid parameters."""
         mysite = self.get_site()
         # start earlier than end
-        self.assertRaises(pywikibot.Error, mysite.usercontribs,
+        self.assertRaises(AssertionError, mysite.usercontribs,
                           userprefix='Jim',
                           start='2008-10-03T00:00:01Z',
                           end='2008-10-03T23:59:59Z', total=5)
         # reverse: end earlier than start
-        self.assertRaises(pywikibot.Error, mysite.usercontribs,
+        self.assertRaises(AssertionError, mysite.usercontribs,
                           userprefix='Jim',
                           start='2008-10-03T23:59:59Z',
                           end='2008-10-03T00:00:01Z', reverse=True, total=5)
@@ -1832,11 +1832,11 @@
                 '2008-10-15T06:00:01Z' <= rev['timestamp']
                 <= '2008-10-15T23:59:59Z')
         # start earlier than end
-        self.assertRaises(pywikibot.Error, mysite.watchlist_revs,
+        self.assertRaises(AssertionError, mysite.watchlist_revs,
                           start='2008-09-03T00:00:01Z',
                           end='2008-09-03T23:59:59Z', total=5)
         # reverse: end earlier than start
-        self.assertRaises(pywikibot.Error, mysite.watchlist_revs,
+        self.assertRaises(AssertionError, mysite.watchlist_revs,
                           start='2008-09-03T23:59:59Z',
                           end='2008-09-03T00:00:01Z', reverse=True, total=5)
         for rev in mysite.watchlist_revs(namespaces=[6, 7], total=5):
@@ -1937,11 +1937,11 @@
                                         '2008-10-15T06:00:01Z')

         # start earlier than end
-        self.assertRaises(pywikibot.Error, mysite.deletedrevs,
+        self.assertRaises(AssertionError, mysite.deletedrevs,
                           page=mainpage, start='2008-09-03T00:00:01Z',
                           end='2008-09-03T23:59:59Z', total=5)
         # reverse: end earlier than start
-        self.assertRaises(pywikibot.Error, mysite.deletedrevs,
+        self.assertRaises(AssertionError, mysite.deletedrevs,
                           page=mainpage, start='2008-09-03T23:59:59Z',
                           end='2008-09-03T00:00:01Z', reverse=True,
                           total=5)
@@ -2021,10 +2021,10 @@
         """Test that site.protect() throws an exception for invalid args."""
         site = self.get_site()
         p1 = pywikibot.Page(site, 'User:Unicodesnowman/ProtectTest')
-        self.assertRaises(pywikibot.Error, site.protect,
+        self.assertRaises(AssertionError, site.protect,
                           protections={'anInvalidValue': 'sysop'},
                           page=p1, reason='Pywikibot unit test')
-        self.assertRaises(pywikibot.Error, site.protect,
+        self.assertRaises(AssertionError, site.protect,
                           protections={'edit': 'anInvalidValue'},
                           page=p1, reason='Pywikibot unit test')


--
To view, visit https://gerrit.wikimedia.org/r/538570
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib260d6b3e2ced977d1e4757abb71852f695fc52e
Gerrit-Change-Number: 538570
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Mpaa <[email protected]>
Gerrit-Reviewer: jenkins-bot (75)
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to