Open Atheuz opened 1 year ago
Hi,
In the README, here: https://github.com/vcoder4c/cron-validator/blob/master/README.md#sample
There is this bit of sample code for validating a cron expression:
from cron_validator import CronValidator assert CronValidator.parse('* * * * *') is not None # valid assert CronValidator.parse('*/3 * * * *') is not None # valid assert CronValidator.parse('*/61 * * * *') is None # invalid
This is not what it actually does:
CronValidator.parse('* * * * *') is not None => True CronValidator.parse('*/3 * * * *') is not None => True CronValidator.parse('*/61 * * * *') => ValueError: Invalid expression part 0
I.E. passing an invalid value to CronValidator.parse makes it raise a ValueError, it doesn't return None.
I don't mind the ValueError, I just didn't understand why the described behaviour and actual behaviour were different.
Also:
CronValidator.parse(0) => AttributeError: 'int' object has no attribute 'split' # Should be a ValueError?
Hi,
In the README, here: https://github.com/vcoder4c/cron-validator/blob/master/README.md#sample
There is this bit of sample code for validating a cron expression:
This is not what it actually does:
I.E. passing an invalid value to CronValidator.parse makes it raise a ValueError, it doesn't return None.
I don't mind the ValueError, I just didn't understand why the described behaviour and actual behaviour were different.
Also: