Merge pull request #15 from jikamens/master
BUG: Allow "-sun" to be specified as the RHS of a weekday range
This commit is contained in:
commit
5970572cfc
2 changed files with 6 additions and 0 deletions
|
@ -207,6 +207,9 @@ class _Matcher(object):
|
|||
def _parse_piece(it):
|
||||
if '-' in it:
|
||||
start, end = map(_fix, it.split('-'))
|
||||
# Allow "sat-sun"
|
||||
if which == 4 and end == 0:
|
||||
end = 7
|
||||
elif it == '*':
|
||||
start = _start
|
||||
end = _end
|
||||
|
|
|
@ -85,6 +85,9 @@ class TestCrontab(unittest.TestCase):
|
|||
self._run_test('0 0 ? 7 mon', 4*86400, datetime.datetime(2011, 7, 15))
|
||||
self._run_test('0 0 ? 7 mon', 366*86400, datetime.datetime(2011, 7, 25, 1))
|
||||
self._run_test('0 0 ? 8 mon-fri', 5*86400 + 1, datetime.datetime(2011, 7, 27, 1))
|
||||
self._run_test('0 12 * * sat-sun', 129600, datetime.datetime(2015, 11, 6), 129600)
|
||||
self._run_test('0 12 * * sat-sun', 86400, datetime.datetime(2015, 11, 7, 12), 86400)
|
||||
self._run_test('0 12 * * sat-sun', 518400, datetime.datetime(2015, 11, 8, 12), 518400)
|
||||
|
||||
def test_last_day(self):
|
||||
self._run_test('0 0 L 2 ?', 28*86400, datetime.datetime(2011, 1, 31))
|
||||
|
|
Loading…
Reference in a new issue