From b2fe33fdaa14ec79cf554d76c64abc508e508302 Mon Sep 17 00:00:00 2001 From: Adam Williamson <awilliam@redhat.com> Date: Fri, 23 Aug 2024 13:37:48 -0700 Subject: [PATCH] test_listing: add test_list_repr This covers the `List.__repr__` method. Signed-off-by: Adam Williamson <awilliam@redhat.com> --- test/test_listing.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/test_listing.py b/test/test_listing.py index 8fccdc3..3ab9802 100644 --- a/test/test_listing.py +++ b/test/test_listing.py @@ -221,6 +221,15 @@ class TestList(unittest.TestCase): vals = [x for x in lst] assert len(vals) == 0 + @mock.patch('mwclient.client.Site') + def test_list_repr(self, mock_site): + # Test __repr__ of a List is as expected + + mock_site.__str__.return_value = "some wiki" + lst = List(mock_site, 'allpages', 'ap', limit=2, + return_values=('title', 'ns')) + assert repr(lst) == "<List object 'allpages' for some wiki>" + @mock.patch('mwclient.client.Site') def test_generator_list(self, mock_site): # Test that the GeneratorList yields Page objects -- GitLab