b4fbd6fe9f
Deploy Site / deploy-vercel (push) Has been skipped
Deploy Site / deploy-docs (push) Has been skipped
Build Skills Index / build-index (push) Has been skipped
Build Skills Index / trigger-deploy (push) Waiting to run
CI / Deny unrelated histories (push) Has been skipped
CI / CI timing report (push) Blocked by required conditions
CI / Detect affected areas (push) Successful in 27m35s
CI / OSV scan (push) Failing after 4s
CI / Build&Test Docker image (push) Successful in 9s
CI / Supply-chain scan (push) Has been skipped
CI / Lint Docker scripts (push) Failing after 5m13s
CI / Check contributors (push) Failing after 12m8s
CI / Docs Site (push) Failing after 12m8s
CI / TypeScript (push) Failing after 12m8s
CI / Python lints (push) Failing after 12m9s
CI / Python tests (push) Failing after 12m9s
CI / Check uv.lock (push) Failing after 23m22s
CI / All required checks pass (push) Waiting to run
30 lines
952 B
Python
30 lines
952 B
Python
"""Tests for shared truthy-value helpers."""
|
|
|
|
from utils import env_var_enabled, is_truthy_value
|
|
|
|
|
|
def test_is_truthy_value_accepts_common_truthy_strings():
|
|
assert is_truthy_value("true") is True
|
|
assert is_truthy_value(" YES ") is True
|
|
assert is_truthy_value("on") is True
|
|
assert is_truthy_value("1") is True
|
|
|
|
|
|
def test_is_truthy_value_respects_default_for_none():
|
|
assert is_truthy_value(None, default=True) is True
|
|
assert is_truthy_value(None, default=False) is False
|
|
|
|
|
|
def test_is_truthy_value_rejects_falsey_strings():
|
|
assert is_truthy_value("false") is False
|
|
assert is_truthy_value("0") is False
|
|
assert is_truthy_value("off") is False
|
|
|
|
|
|
def test_env_var_enabled_uses_shared_truthy_rules(monkeypatch):
|
|
monkeypatch.setenv("HERMES_TEST_BOOL", "YeS")
|
|
assert env_var_enabled("HERMES_TEST_BOOL") is True
|
|
|
|
monkeypatch.setenv("HERMES_TEST_BOOL", "no")
|
|
assert env_var_enabled("HERMES_TEST_BOOL") is False
|