Xqt has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/661716 )
Change subject: [bugfix] Fix several assertRaises tests
......................................................................
[bugfix] Fix several assertRaises tests
Change-Id: If81f0d3b1a8b097649d0b93d3c7d9483e00accc8
---
M tests/pagegenerators_tests.py
M tests/site_tests.py
2 files changed, 7 insertions(+), 8 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index 3332c68..0e6c92f 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -1004,8 +1004,8 @@
gf.handle_arg('-ns:3,1')
# allpages only accepts a single namespace, and will raise a
# TypeError if self.namespaces contains more than one namespace.
- with self.assertRaises(
- TypeError,
+ with self.assertRaisesRegex(
+ TypeError,
'allpages module does not support multiple namespaces'):
gf.getCombinedGenerator()
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 7f8af74..c00f5a3 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -982,9 +982,8 @@
p1 = pywikibot.Page(site, 'Foo')
site.lock_page(page=p1, block=True)
- with self.assertRaises(pywikibot.site.PageInUs):
- site.lock_page(page=p1,
- block=False)
+ with self.assertRaises(pywikibot.site.PageInUse):
+ site.lock_page(page=p1, block=False)
site.unlock_page(page=p1)
# verify it's unlocked
site.lock_page(page=p1, block=False)
@@ -3437,11 +3436,11 @@
with self.assertRaises(pywikibot.UnknownExtension):
site._cache_proofreadinfo()
with self.assertRaises(pywikibot.UnknownExtension):
- lambda x: x.proofread_index_ns(site)
+ site.proofread_index_ns
with self.assertRaises(pywikibot.UnknownExtension):
- lambda x: x.proofread_page_ns(site)
+ site.proofread_page_ns
with self.assertRaises(pywikibot.UnknownExtension):
- lambda x: x.proofread_levels(site)
+ site.proofread_levels
class TestPropertyNames(DefaultSiteTestCase):
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/661716
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: If81f0d3b1a8b097649d0b93d3c7d9483e00accc8
Gerrit-Change-Number: 661716
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[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