jenkins-bot has submitted this change and it was merged.
Change subject: Archivebot: Ignore dates with hour > 23 ......................................................................
Archivebot: Ignore dates with hour > 23
textlib.py:1318 would throw ValueError for dates with hour > 23. Ran into this problem with a user who entered signature dates manually.
Change-Id: I98285e97dd81f2eb78596ca0cfdd0cdcac958a74 --- M pywikibot/textlib.py M tests/timestripper_tests.py 2 files changed, 6 insertions(+), 1 deletion(-)
Approvals: John Vandenberg: Looks good to me, approved Mpaa: Looks good to me, but someone else must approve jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py index 0221449..0efe511 100644 --- a/pywikibot/textlib.py +++ b/pywikibot/textlib.py @@ -1202,7 +1202,7 @@
self.groups = [u'year', u'month', u'hour', u'time', u'day', u'minute', u'tzinfo']
- timeR = r'(?P<time>(?P<hour>[0-2]\d)[:.h](?P<minute>[0-5]\d))' + timeR = r'(?P<time>(?P<hour>([0-1]\d|2[0-3]))[:.h](?P<minute>[0-5]\d))' timeznR = r'((?P<tzinfo>[A-Z]+))' yearR = r'(?P<year>(19|20)\d\d)'
diff --git a/tests/timestripper_tests.py b/tests/timestripper_tests.py index 07ae408..d3b1ff6 100644 --- a/tests/timestripper_tests.py +++ b/tests/timestripper_tests.py @@ -76,6 +76,8 @@ """Test that correct date is matched.""" txtMatch = u'3 février 2010 à 19:48 (CET) 7 février 2010 à 19:48 (CET)' txtNoMatch = u'3 March 2010 19:48 (CET) 7 March 2010 19:48 (CET)' + txtHourInRange = u'7 février 2010 à 23:00 (CET)' + txtHourOutOfRange = u'7 février 2010 à 24:00 (CET)'
tzone = tzoneFixedOffset(self.ts.site.siteinfo['timeoffset'], self.ts.site.siteinfo['timezone']) @@ -85,6 +87,9 @@ self.assertEqual(self.ts.timestripper(txtMatch), res) self.assertEqual(self.ts.timestripper(txtNoMatch), None)
+ self.assertNotEqual(self.ts.timestripper(txtHourInRange), None) + self.assertEqual(self.ts.timestripper(txtHourOutOfRange), None) +
class TestTimeStripperWithDigitsAsMonths(PywikibotTestCase):
pywikibot-commits@lists.wikimedia.org