jenkins-bot has submitted this change and it was merged.
Change subject: Add maxlag regexp tests ......................................................................
Add maxlag regexp tests
Bug: T144023 Change-Id: Iacd0cadca90b3b7debafcb2d3e4f95352b356bb1 --- M tests/api_tests.py 1 file changed, 12 insertions(+), 0 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/api_tests.py b/tests/api_tests.py index 5507956..704a853 100644 --- a/tests/api_tests.py +++ b/tests/api_tests.py @@ -1065,6 +1065,18 @@ self.assertIsInstance(value, int) self.assertGreaterEqual(value, 0)
+ def test_individual_patterns(self): + """Test api.lagpattern with example patterns.""" + patterns = { + 'Waiting for 10.64.32.115: 0.14024019241333 seconds lagged': 0, + 'Waiting for hostname: 5 seconds lagged': 5, + 'Waiting for 127.0.0.1: 1.7 seconds lagged': 1 + } + for info, time in patterns.items(): + lag = api.lagpattern.search(info) + self.assertIsNotNone(lag) + self.assertEqual(int(lag.group("lag")), time) +
if __name__ == '__main__': # pragma: no cover try:
pywikibot-commits@lists.wikimedia.org