Removed unreachable defensive guards and added test for strptime ValueError path.
Format / ruff (push) Successful in 10s
Lint / ruff (push) Failing after 10s
Unit Tests / pytest (push) Successful in 18s
Type Check / mypy (push) Failing after 18s

This commit is contained in:
2026-02-16 19:55:28 -05:00
parent b8e7663bf4
commit 04208b0649
2 changed files with 8 additions and 4 deletions
@@ -366,8 +366,6 @@ async def _evaluate_count(
"RETURNING value", "RETURNING value",
(counter_name, delta, delta), (counter_name, delta, delta),
) )
if row is None:
raise PlaceholderError("Internal error: counter update failed")
return str(row["value"]) return str(row["value"])
else: else:
try: try:
@@ -381,8 +379,6 @@ async def _evaluate_count(
"RETURNING value", "RETURNING value",
(counter_name, value), (counter_name, value),
) )
if row is None:
raise PlaceholderError("Internal error: counter update failed")
return str(row["value"]) return str(row["value"])
+8
View File
@@ -548,6 +548,14 @@ class TestCountdownCountup:
"expected $(countup Dec 25 2025 12:00:00 AM EST)" "expected $(countup Dec 25 2025 12:00:00 AM EST)"
) )
async def test_countdown_valid_timezone_bad_date_format(self):
"""$(countdown) with a recognized timezone but malformed date reports an error."""
result = await process("$(countdown not a valid date UTC)")
assert result == (
"Invalid $(countdown): unrecognized date format, "
"expected $(countdown Dec 25 2025 12:00:00 AM EST)"
)
async def test_countup_future_date_returns_zero(self): async def test_countup_future_date_returns_zero(self):
"""$(countup) with a future date returns '0 seconds'.""" """$(countup) with a future date returns '0 seconds'."""
result = await process("$(countup Dec 25 2099 12:00:00 AM UTC)") result = await process("$(countup Dec 25 2099 12:00:00 AM UTC)")