Files
2026-07-13 13:12:00 +08:00

66 lines
2.1 KiB
Python
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Tests for static terminal mascots."""
from __future__ import annotations
from omnigent.inner.mascots import (
MASCOT_ART_COL_WIDTH,
MASCOT_ART_COLOR,
MASCOT_ART_LINES,
mascot_payload_for_identity,
random_mascot_color,
random_mascot_lines,
)
def test_random_mascot_lines_returns_otto_the_starfish() -> None:
"""The TUI mascot uses the static Otto-the-starfish art."""
lines = random_mascot_lines()
assert lines == [
"⠀⢠⣿⡄⠀",
"⢴⣶⣶⠉⣿⠉⣶⣶⡦",
"⠀⠙⣿⣶⣿⣶⣿⠋⠀",
"⠀⢠⣿⡿⠿⢿⣿⡄⠀",
"⠀⠈⠁⠀⠀⠈⠁⠀",
]
assert MASCOT_ART_COL_WIDTH == 9
# The art is symbol-only: no letters or digits anywhere.
assert all(not any(ch.isalnum() for ch in line) for line in lines)
assert all(len(line) == MASCOT_ART_COL_WIDTH for line in lines)
def test_mascot_art_color_matches_panel_border_token() -> None:
"""The mascot color matches the startup panel accent."""
assert random_mascot_color() == MASCOT_ART_COLOR
assert MASCOT_ART_COLOR == "#F43BA6"
def test_mascot_payload_for_identity_stable() -> None:
"""The identity payload is deterministic for the same seed."""
seed = "demo\x00tool_a,tool_b\x00You are a helper."
assert mascot_payload_for_identity(seed) == mascot_payload_for_identity(seed)
def test_mascot_payload_color_is_six_digit_hex_for_many_identities() -> None:
"""The identity payload color stays valid across many seeds."""
for index in range(256):
payload = mascot_payload_for_identity(f"agent-{index}")
assert payload["color"].startswith("#")
assert len(payload["color"]) == 7
int(payload["color"][1:], 16)
def test_mascot_payload_for_identity_shape() -> None:
"""The identity payload carries static art and a valid hex color."""
payload = mascot_payload_for_identity("unique-seed-for-shape-test")
assert payload["lines"] == list(MASCOT_ART_LINES)
assert payload["color"].startswith("#")
assert len(payload["color"]) == 7
int(payload["color"][1:], 16)