Time: Skip new assertions on Python 3.6 so testSeconds passes

This commit is contained in:
Valentin Lorentz 2022-08-02 13:16:21 +02:00
parent 8f837a676d
commit b8dce0d7db
2 changed files with 13 additions and 5 deletions

View File

@ -73,8 +73,11 @@ except ImportError:
tzlocal = None
# Note: Python 3.6 does not support empty pattern matches, see:
# https://docs.python.org/3/library/re.html#re.split
_SECONDS_SPLIT_RE = re.compile('(?<=[a-z]) ?')
class Time(callbacks.Plugin):
"""This plugin allows you to use different time-related functions."""
@internationalizeDocstring

View File

@ -77,21 +77,26 @@ class TimeTestCase(PluginTestCase):
self.assertResponse('seconds 10s', '10')
self.assertResponse('seconds 1m', '60')
self.assertResponse('seconds 1m 1s', '61')
self.assertResponse('seconds 1m1s', '61')
self.assertResponse('seconds 1h', '3600')
self.assertResponse('seconds 1h 1s', '3601')
self.assertResponse('seconds 1h1s', '3601')
self.assertResponse('seconds 1d', '86400')
self.assertResponse('seconds 1d 1s', '86401')
self.assertResponse('seconds 1d1s', '86401')
self.assertResponse('seconds 2s', '2')
self.assertResponse('seconds 2m', '120')
self.assertResponse('seconds 2d 2h 2m 2s', '180122')
self.assertResponse('seconds 2d2h2m2s', '180122')
self.assertResponse('seconds 1s', '1')
self.assertResponse('seconds 1y 1s', '31536001')
self.assertResponse('seconds 1y1s', '31536001')
self.assertResponse('seconds 1w 1s', '604801')
@skipIf(sys.version_info < (3, 7, 0),
"Python 3.6 does not support emptypattern matches, see: "
"https://docs.python.org/3/library/re.html#re.split")
def testSecondsNoSpace(self):
self.assertResponse('seconds 1m1s', '61')
self.assertResponse('seconds 1h1s', '3601')
self.assertResponse('seconds 1d1s', '86401')
self.assertResponse('seconds 2d2h2m2s', '180122')
self.assertResponse('seconds 1y1s', '31536001')
self.assertResponse('seconds 1w1s', '604801')
def testNoErrors(self):