Public Access
Post-merge / detect-type (push) Successful in 9s
Post-merge / validate-commit-msg (push) Successful in 9s
Build Images / detect-type (push) Successful in 42s
Post-merge / vikunja (push) Successful in 17s
Post-merge / release (push) Successful in 52s
Post-merge / configure-repo (push) Successful in 23s
Post-merge / badges (push) Successful in 55s
Post-merge / sync-wiki (push) Successful in 58s
Post-merge / publish (push) Successful in 21s
Build Images / build-and-push (push) Successful in 3m15s
Build Images / cleanup (push) Successful in 3m38s
55 lines
1.4 KiB
Python
55 lines
1.4 KiB
Python
"""Unit tests for devx.utils.api."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from devx.utils.api import is_falsy, is_truthy
|
|
|
|
|
|
class TestIsTruthy:
|
|
def test_string_true(self) -> None:
|
|
assert is_truthy("true") is True
|
|
|
|
def test_string_true_uppercase(self) -> None:
|
|
assert is_truthy("True") is True
|
|
|
|
def test_boolean_true(self) -> None:
|
|
assert is_truthy(True) is True
|
|
|
|
def test_string_false(self) -> None:
|
|
assert is_truthy("false") is False
|
|
|
|
def test_boolean_false(self) -> None:
|
|
assert is_truthy(False) is False
|
|
|
|
def test_none(self) -> None:
|
|
assert is_truthy(None) is False
|
|
|
|
def test_empty_string(self) -> None:
|
|
assert is_truthy("") is False
|
|
|
|
def test_random_string(self) -> None:
|
|
assert is_truthy("random") is False
|
|
|
|
|
|
class TestIsFalsy:
|
|
def test_string_false(self) -> None:
|
|
assert is_falsy("false") is True
|
|
|
|
def test_string_false_uppercase(self) -> None:
|
|
assert is_falsy("False") is True
|
|
|
|
def test_boolean_false(self) -> None:
|
|
assert is_falsy(False) is True
|
|
|
|
def test_string_true(self) -> None:
|
|
assert is_falsy("true") is False
|
|
|
|
def test_boolean_true(self) -> None:
|
|
assert is_falsy(True) is False
|
|
|
|
def test_none(self) -> None:
|
|
assert is_falsy(None) is False
|
|
|
|
def test_empty_string(self) -> None:
|
|
assert is_falsy("") is False
|