555e282cc4
ci / changelog_check (push) Waiting to run
ci / check_changes (push) Waiting to run
ci / build_mem0 (3.10) (push) Blocked by required conditions
ci / build_mem0 (3.11) (push) Blocked by required conditions
ci / build_mem0 (3.12) (push) Blocked by required conditions
CLI Node CI / lint (push) Waiting to run
CLI Node CI / test (20) (push) Waiting to run
CLI Node CI / test (22) (push) Waiting to run
CLI Node CI / build (push) Waiting to run
CLI Python CI / lint (push) Waiting to run
CLI Python CI / test (3.10) (push) Waiting to run
CLI Python CI / test (3.11) (push) Waiting to run
CLI Python CI / test (3.12) (push) Waiting to run
CLI Python CI / build (push) Waiting to run
openclaw checks / lint (push) Waiting to run
openclaw checks / test (20) (push) Waiting to run
openclaw checks / test (22) (push) Waiting to run
openclaw checks / build (push) Waiting to run
opencode-plugin checks / build (push) Waiting to run
pi-agent-plugin checks / lint (push) Waiting to run
pi-agent-plugin checks / test (20) (push) Waiting to run
pi-agent-plugin checks / test (22) (push) Waiting to run
pi-agent-plugin checks / build (push) Waiting to run
TypeScript SDK CI / check_changes (push) Waiting to run
TypeScript SDK CI / changelog_check (push) Blocked by required conditions
TypeScript SDK CI / build_ts_sdk (20) (push) Blocked by required conditions
TypeScript SDK CI / build_ts_sdk (22) (push) Blocked by required conditions
TypeScript SDK CI / integration_ts_sdk (20) (push) Blocked by required conditions
TypeScript SDK CI / integration_ts_sdk (22) (push) Blocked by required conditions
55 lines
1.6 KiB
Python
55 lines
1.6 KiB
Python
"""Tests for branding and output helpers."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from io import StringIO
|
|
|
|
from rich.console import Console
|
|
|
|
from mem0_cli.branding import print_banner, print_error, print_info, print_success, print_warning
|
|
|
|
|
|
def _make_console() -> tuple[Console, StringIO]:
|
|
buf = StringIO()
|
|
return Console(file=buf, force_terminal=False, no_color=True, width=80), buf
|
|
|
|
|
|
class TestBranding:
|
|
def test_print_banner(self):
|
|
console, buf = _make_console()
|
|
print_banner(console)
|
|
output = buf.getvalue()
|
|
# Banner contains the mem0 ASCII art and tagline
|
|
assert "Memory Layer" in output or "mem" in output.lower()
|
|
|
|
def test_print_success(self):
|
|
console, buf = _make_console()
|
|
print_success(console, "It worked!")
|
|
output = buf.getvalue()
|
|
assert "It worked!" in output
|
|
|
|
def test_print_error(self):
|
|
console, buf = _make_console()
|
|
print_error(console, "Something failed", hint="Try this fix")
|
|
output = buf.getvalue()
|
|
assert "Something failed" in output
|
|
assert "Try this fix" in output
|
|
|
|
def test_print_error_no_hint(self):
|
|
console, buf = _make_console()
|
|
print_error(console, "Failed")
|
|
output = buf.getvalue()
|
|
assert "Failed" in output
|
|
|
|
def test_print_warning(self):
|
|
console, buf = _make_console()
|
|
print_warning(console, "Watch out")
|
|
output = buf.getvalue()
|
|
assert "Watch out" in output
|
|
|
|
def test_print_info(self):
|
|
console, buf = _make_console()
|
|
print_info(console, "FYI")
|
|
output = buf.getvalue()
|
|
assert "FYI" in output
|