Removed unreachable defensive guards and added test for strptime ValueError path.
This commit is contained in:
@@ -366,8 +366,6 @@ async def _evaluate_count(
|
||||
"RETURNING value",
|
||||
(counter_name, delta, delta),
|
||||
)
|
||||
if row is None:
|
||||
raise PlaceholderError("Internal error: counter update failed")
|
||||
return str(row["value"])
|
||||
else:
|
||||
try:
|
||||
@@ -381,8 +379,6 @@ async def _evaluate_count(
|
||||
"RETURNING value",
|
||||
(counter_name, value),
|
||||
)
|
||||
if row is None:
|
||||
raise PlaceholderError("Internal error: counter update failed")
|
||||
return str(row["value"])
|
||||
|
||||
|
||||
|
||||
@@ -548,6 +548,14 @@ class TestCountdownCountup:
|
||||
"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):
|
||||
"""$(countup) with a future date returns '0 seconds'."""
|
||||
result = await process("$(countup Dec 25 2099 12:00:00 AM UTC)")
|
||||
|
||||
Reference in New Issue
Block a user