Add test files
Some checks failed
CI / test (push) Failing after 11s

This commit is contained in:
2026-02-01 15:10:17 +00:00
parent 7ab9b9e010
commit 1059dafdf4

41
tests/test_describer.py Normal file
View 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