jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/762058 )
Change subject: [tests] replace type-specific assertEqual methods ......................................................................
[tests] replace type-specific assertEqual methods
type-specific assertEqual methods are already dispatched by the assertEqual method and unnecessary to call them explicitly.
Change-Id: I3a2af8148c41cec3364f54b3711c4b6c9df55e95 --- M tests/flow_edit_tests.py M tests/http_tests.py M tests/site_tests.py M tests/sparql_tests.py 4 files changed, 15 insertions(+), 12 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/flow_edit_tests.py b/tests/flow_edit_tests.py index 74333f0..f09a40b 100644 --- a/tests/flow_edit_tests.py +++ b/tests/flow_edit_tests.py @@ -135,7 +135,7 @@
# Nested reply old_nested_replies = first_reply_post.replies(force=True)[:] - self.assertListEqual(old_nested_replies, []) + self.assertEqual(old_nested_replies, []) second_reply_post = first_reply_post.reply(second_content, 'wikitext') # Test nested reply's content @@ -151,7 +151,7 @@ # self.assertLength(new_nested_replies, len(old_nested_replies) + 1)
# Current test for nested reply list - self.assertListEqual(old_nested_replies, []) + self.assertEqual(old_nested_replies, []) more_root_replies = topic_root.replies(force=True) self.assertLength(more_root_replies, len(new_root_replies) + 1)
diff --git a/tests/http_tests.py b/tests/http_tests.py index 62b066e..62c2a37 100644 --- a/tests/http_tests.py +++ b/tests/http_tests.py @@ -558,7 +558,7 @@ self.assertEqual(r.status_code, HTTPStatus.OK)
content = json.loads(r.text) - self.assertDictEqual(content['args'], {}) + self.assertEqual(content['args'], {})
def test_unencoded_params(self): """ @@ -577,7 +577,7 @@ self.assertEqual(r.status_code, HTTPStatus.OK)
content = json.loads(r.text) - self.assertDictEqual(content['args'], {'fish&chips': 'delicious'}) + self.assertEqual(content['args'], {'fish&chips': 'delicious'})
def test_encoded_params(self): """ @@ -596,7 +596,7 @@ self.assertEqual(r.status_code, HTTPStatus.OK)
content = json.loads(r.text) - self.assertDictEqual(content['args'], {'fish%26chips': 'delicious'}) + self.assertEqual(content['args'], {'fish%26chips': 'delicious'})
class DataBodyParameterTestCase(HttpbinTestCase): @@ -625,7 +625,7 @@ r_data['headers'].pop(tracker_id, None) r_body['headers'].pop(tracker_id, None)
- self.assertDictEqual(r_data, r_body) + self.assertEqual(r_data, r_body)
if __name__ == '__main__': # pragma: no cover diff --git a/tests/site_tests.py b/tests/site_tests.py index faf457c..2d3ce36 100644 --- a/tests/site_tests.py +++ b/tests/site_tests.py @@ -896,8 +896,9 @@ if not self.site.data_repository(): self.skipTest('Site is not using a Wikibase repository') upgen = self.site.unconnected_pages(total=3) - self.assertDictEqual( - upgen.request._params, { + self.assertEqual( + upgen.request._params, + { 'gqppage': ['UnconnectedPages'], 'prop': ['info', 'imageinfo', 'categoryinfo'], 'inprop': ['protection'], @@ -905,7 +906,9 @@ 'iiprop': ['timestamp', 'user', 'comment', 'url', 'size', 'sha1', 'metadata'], 'generator': ['querypage'], 'action': ['query'], - 'indexpageids': [True], 'continue': [True]}) + 'indexpageids': [True], 'continue': [True] + } + ) self.assertLessEqual(len(tuple(upgen)), 3)
def test_assert_valid_iter_params(self): diff --git a/tests/sparql_tests.py b/tests/sparql_tests.py index 4f9b808..d909805 100644 --- a/tests/sparql_tests.py +++ b/tests/sparql_tests.py @@ -106,12 +106,12 @@ self.assertIsInstance(res, list, 'Result is not a list') self.assertLength(res, 2)
- self.assertDictEqual( + self.assertEqual( res[0], {'cat': 'http://www.wikidata.org/entity/Q498787', 'catLabel': 'Muezza', 'd': '1955-01-01T00:00:00Z'}, 'Bad result') - self.assertDictEqual( + self.assertEqual( res[1], {'cat': 'http://www.wikidata.org/entity/Q677525', 'catLabel': 'Orangey', 'd': '2015-06-22T00:00:00Z'}, @@ -156,7 +156,7 @@ with skipping(pywikibot.exceptions.TimeoutError): q = sparql.SparqlQuery() res = q.get_items('SELECT * WHERE { ?x ?y ?z }', 'cat') - self.assertSetEqual(res, {'Q498787', 'Q677525'}) + self.assertEqual(res, {'Q498787', 'Q677525'}) res = q.get_items('SELECT * WHERE { ?x ?y ?z }', 'cat', result_type=list) self.assertEqual(res, ['Q498787', 'Q677525', 'Q677525'])
pywikibot-commits@lists.wikimedia.org