Xqt has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1277257?usp=email )

Change subject: tests: replace assertRaises with assertRaisesRegex in 
api_tests.py
......................................................................

tests: replace assertRaises with assertRaisesRegex in api_tests.py

- Updated test_namespace_for_module_with_no_limit to use assertRaisesRegex.
- This provides better error validation by checking the exception message.
- This patch resolves the work left from abandoned change 1239492.

Bug: T154281
Change-Id: Ib307136b4e738b7f4ed000c380188db1743f178d
---
M tests/api_tests.py
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Xqt: Verified; Looks good to me, approved




diff --git a/tests/api_tests.py b/tests/api_tests.py
index bf50c77..93a7622 100755
--- a/tests/api_tests.py
+++ b/tests/api_tests.py
@@ -465,7 +465,7 @@
         """Test PageGenerator set_namespace."""
         for namespace in (0, 1, None):
             with self.subTest(namespace=namespace), \
-                 self.assertRaisesRegex(TypeError, SET_NAMESPACE_MODULE):
+                    self.assertRaisesRegex(TypeError, SET_NAMESPACE_MODULE):
                 self.gen.set_namespace(namespace)


@@ -622,7 +622,7 @@
                                      parameters={'titles': 'test'})
         for namespace in (0, 1, None):
             with self.subTest(namespace=namespace), \
-                    self.assertRaises(TypeError):
+                    self.assertRaisesRegex(TypeError, SET_NAMESPACE_MODULE):
                 self.gen.set_namespace(namespace)

     def test_namespace_param_is_not_settable(self) -> None:

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1277257?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ib307136b4e738b7f4ed000c380188db1743f178d
Gerrit-Change-Number: 1277257
Gerrit-PatchSet: 1
Gerrit-Owner: Raushan 31 <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to