Skip to content

Commit 1458d63

Browse files
authored
Merge pull request #4 from dapper91/dev
week iteration bug fixed.
2 parents cda733d + 4950f30 commit 1458d63

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changelog
22
=========
33

4+
0.1.2 (2021-03-16)
5+
------------------
6+
7+
- bug fixes
8+
9+
410
0.1.1 (2021-03-16)
511
------------------
612

crontools/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
__description__ = 'Python cron tools'
33
__url__ = 'https://github.com/dapper91/crontools'
44

5-
__version__ = '0.1.1'
5+
__version__ = '0.1.2'
66

77
__author__ = 'Dmitry Pershin'
88
__email__ = '[email protected]'

crontools/crontab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def _weekday_iter(self, year: int, month: int, start_day: int = 1) -> Iterator[i
334334
curr_weekday = calendar.weekday(year, month, curr_day) + 1
335335
weekday_iter = self._weekday_field.iter(start_from=curr_weekday)
336336

337-
for _ in range(5):
337+
for _ in range(6):
338338
for weekday in weekday_iter:
339339
curr_day += (weekday - curr_weekday)
340340
curr_weekday += (weekday - curr_weekday)

tests/test_crontab.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,26 @@ def test_cron_iterator(expr, result, years_ext, seconds_ext):
412412
False,
413413
False,
414414
),
415+
(
416+
'0 0 1-31 * *',
417+
dt.datetime(year=2020, month=1, day=1, tzinfo=dt.timezone.utc),
418+
[
419+
dt.datetime(year=2020, month=1, day=1, tzinfo=dt.timezone.utc) + dt.timedelta(days=day)
420+
for day in range(368)
421+
],
422+
False,
423+
False,
424+
),
425+
(
426+
'0 0 * * MON-SUN',
427+
dt.datetime(year=2020, month=1, day=1, tzinfo=dt.timezone.utc),
428+
[
429+
dt.datetime(year=2020, month=1, day=1, tzinfo=dt.timezone.utc) + dt.timedelta(days=day)
430+
for day in range(367*7)
431+
],
432+
False,
433+
False,
434+
),
415435
],
416436
)
417437
@freezegun.freeze_time('2020-01-01 00:00:00.000Z+00:00')

0 commit comments

Comments
 (0)