diff options
author | Alex Grönholm <alex.gronholm@nextday.fi> | 2017-12-12 00:26:33 +0200 |
---|---|---|
committer | Alex Grönholm <alex.gronholm@nextday.fi> | 2017-12-12 00:26:33 +0200 |
commit | 39cb1a5f65a2d5970b9639e3e324ad7953d261f9 (patch) | |
tree | c511cca2f7af557a008ad9d604efcfe1a80a102d /tests | |
parent | 858204838d78ac15ee6f9461ad26c57bbe96db4a (diff) | |
download | apscheduler-39cb1a5f65a2d5970b9639e3e324ad7953d261f9.tar.gz |
Added support for creating cron triggers from crontab expressions
Fixes #240.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_triggers.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_triggers.py b/tests/test_triggers.py index ca07963..34372a5 100644 --- a/tests/test_triggers.py +++ b/tests/test_triggers.py @@ -387,6 +387,18 @@ class TestCronTrigger(object): def test_invalid_ranges(self, values, expected): pytest.raises(ValueError, CronTrigger, **values).match(expected) + @pytest.mark.parametrize('expr, expected_repr', [ + ('* * * * *', + "<CronTrigger (month='*', day='*', day_of_week='*', hour='*', minute='*', " + "timezone='Europe/Berlin', jitter='None')>"), + ('0-14 * 14-28 jul fri', + "<CronTrigger (month='jul', day='14-28', day_of_week='fri', hour='*', minute='0-14', " + "timezone='Europe/Berlin', jitter='None')>") + ], ids=['always', 'assorted']) + def test_from_crontab(self, expr, expected_repr, timezone): + trigger = CronTrigger.from_crontab(expr, timezone) + assert repr(trigger) == expected_repr + class TestDateTrigger(object): @pytest.mark.parametrize('run_date,alter_tz,previous,now,expected', [ |