jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1005715?usp=email )

Change subject: [bugfix] Fix assertRaises tests in api_tests.py
......................................................................

[bugfix] Fix assertRaises tests in api_tests.py

Bug: T267801
Change-Id: I42d3975ebd1363112e4b2f21cdc0b323065a839d
---
M tests/api_tests.py
1 file changed, 18 insertions(+), 8 deletions(-)

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




diff --git a/tests/api_tests.py b/tests/api_tests.py
index 83db11b..6da76fa 100755
--- a/tests/api_tests.py
+++ b/tests/api_tests.py
@@ -475,10 +475,10 @@

     def test_namespace(self):
         """Test PageGenerator set_namespace."""
-        with self.assertRaises(AssertionError):
-            self.gen.set_namespace(0)
-            self.gen.set_namespace(1)
-            self.gen.set_namespace(None)
+        for namespace in (0, 1, None):
+            with self.subTest(namespace=namespace), \
+                 self.assertRaises(AssertionError):
+                self.gen.set_namespace(namespace)


 class TestPropertyGenerator(TestCase):
@@ -637,10 +637,10 @@
         self.gen = api.PageGenerator(site=self.site,
                                      generator='links',
                                      parameters={'titles': 'test'})
-        with self.assertRaises(AssertionError):
-            self.gen.set_namespace(0)
-            self.gen.set_namespace(1)
-            self.gen.set_namespace(None)
+        for namespace in (0, 1, None):
+            with self.subTest(namespace=namespace), \
+                 self.assertRaises(AssertionError):
+                self.gen.set_namespace(namespace)

     @suppress_warnings(
         r'^set_namespace\(\) will be modified to raise TypeError*',

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1005715?usp=email
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: I42d3975ebd1363112e4b2f21cdc0b323065a839d
Gerrit-Change-Number: 1005715
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to