def test_list_with_str_return_value(self, mock_site): # Test that the List yields strings when return_values is string lst = List(mock_site, 'allpages', 'ap', limit=2, return_values='title') self.setupDummyResponses(mock_site, 'allpages') vals = [x for x in lst] assert len(vals) == 3 assert type(vals[0]) == str
def test_list_continuation(self, mock_site): # Test that the list fetches all three responses # and yields dicts when return_values not set lst = List(mock_site, 'allpages', 'ap', limit=2) self.setupDummyResponses(mock_site, 'allpages') vals = [x for x in lst] assert len(vals) == 3 assert type(vals[0]) == dict
def test_list_with_tuple_return_value(self, mock_site): # Test that the List yields tuples when return_values is tuple lst = List(mock_site, 'allpages', 'ap', limit=2, return_values=('title', 'ns')) self.setupDummyResponses(mock_site, 'allpages') vals = [x for x in lst] assert len(vals) == 3 assert type(vals[0]) == tuple