Xqt submitted this change.
[tests] Fix assertRaises tests in api_tests.py
Bug: T267801
Change-Id: I70e650df3ffe488bf8ccfb029c0844bf61f7e4ae
---
M tests/api_tests.py
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tests/api_tests.py b/tests/api_tests.py
index 69c850b..8974259 100644
--- a/tests/api_tests.py
+++ b/tests/api_tests.py
@@ -334,6 +334,7 @@
pi.fetch('foobar')
with self.assertRaises(KeyError):
pi.__getitem__('foobar')
+ with self.assertRaises(KeyError):
pi.__getitem__('foobar+foobar')
# The warning message may be different with older MW versions.
self.assertIn('API warning (paraminfo): ', w.call_args[0][0])
@@ -360,7 +361,7 @@
with patch.object(pywikibot, 'warning') as w:
with self.assertRaises(KeyError):
- pi.__getitem('query+foobar')
+ pi.__getitem__('query+foobar')
# The warning message may be different with older MW versions.
self.assertIn('API warning (paraminfo): ', w.call_args[0][0])
@@ -476,7 +477,7 @@
"""Test OptionSet with initialised site."""
options = api.OptionSet(self.get_site(), 'recentchanges', 'show')
with self.assertRaises(KeyError):
- options.__setitems__('invalid_name', True)
+ options.__setitem__('invalid_name', True)
with self.assertRaises(ValueError):
options.__setitem__('anon', 'invalid_value')
options['anon'] = True
To view, visit change 657863. To unsubscribe, or for help writing mail filters, visit settings.