41
tests/test_describer.py
Normal file
41
tests/test_describer.py
Normal file
@@ -0,0 +1,41 @@
|
||||
"""Tests for cron description feature."""
|
||||
|
||||
import pytest
|
||||
from cronparse.describer import describe_cron
|
||||
|
||||
|
||||
class TestDescribeCron:
|
||||
"""Tests for describe_cron function."""
|
||||
|
||||
def test_describe_every_minute(self):
|
||||
"""Test describing every minute expression."""
|
||||
result = describe_cron("* * * * *")
|
||||
assert result is not None
|
||||
assert len(result) > 0
|
||||
|
||||
def test_describe_daily_at_nine_am(self):
|
||||
"""Test describing daily at 9 AM expression."""
|
||||
result = describe_cron("0 9 * * *")
|
||||
assert result is not None
|
||||
assert len(result) > 0
|
||||
|
||||
def test_describe_weekly_on_monday(self):
|
||||
"""Test describing weekly on Monday expression."""
|
||||
result = describe_cron("0 9 * * 1")
|
||||
assert result is not None
|
||||
|
||||
def test_describe_monthly_on_first(self):
|
||||
"""Test describing monthly on first day expression."""
|
||||
result = describe_cron("0 0 1 * *")
|
||||
assert result is not None
|
||||
|
||||
def test_24h_format(self):
|
||||
"""Test describing with 24-hour time format."""
|
||||
result = describe_cron("0 14 * * *", use_24h=True)
|
||||
assert result is not None
|
||||
assert "14" in result or "2:00" in result or "14:00" in result
|
||||
|
||||
def test_12h_format(self):
|
||||
"""Test describing with default 12-hour time format."""
|
||||
result = describe_cron("0 14 * * *", use_24h=False)
|
||||
assert result is not None
|
||||
Reference in New Issue
Block a user