jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/513726 )
Change subject: [tests] test ranges of maximum items ......................................................................
[tests] test ranges of maximum items
There are two tests that PageGenerator yields the requested amount of pages which can combined and expanded. The new method also tests not to get more items if query stops.
Change-Id: I78b2354f4f00af59bacc8e0c4646e722bea9b50b --- M tests/api_tests.py 1 file changed, 5 insertions(+), 8 deletions(-)
Approvals: Dvorapa: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/api_tests.py b/tests/api_tests.py index 9cd52b3..f08dbe8 100644 --- a/tests/api_tests.py +++ b/tests/api_tests.py @@ -653,15 +653,12 @@ r"invalid literal for int() with base 10: 'test'"): self.gen.set_maximum_items('test')
- def test_limit_equal_total(self): + def test_limit_range(self): """Test that PageGenerator yields the requested amount of pages.""" - self.gen.set_maximum_items(4) - self.assertPageTitlesEqual(self.gen, self.titles) - - def test_limit_one(self): - """Test that PageGenerator yields the requested amount of pages.""" - self.gen.set_maximum_items(1) - self.assertPageTitlesEqual(self.gen, self.titles[0:1]) + for i in range(1, 6): + with self.subTest(amount=i): + self.gen.set_maximum_items(i) + self.assertPageTitlesEqual(self.gen, self.titles[:i])
def test_limit_zero(self): """Test that a limit of zero is the same as limit None."""