jenkins-bot merged this change.

View Change

Approvals: Dvorapa: Looks good to me, approved jenkins-bot: Verified
[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(-)

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."""

To view, visit change 513726. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I78b2354f4f00af59bacc8e0c4646e722bea9b50b
Gerrit-Change-Number: 513726
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: jenkins-bot (75)