56 lines
1.5 KiB
Python
56 lines
1.5 KiB
Python
"""
|
|
Tests for engine.app module.
|
|
"""
|
|
|
|
from engine.app import _normalize_preview_rows
|
|
|
|
|
|
class TestNormalizePreviewRows:
|
|
"""Tests for _normalize_preview_rows function."""
|
|
|
|
def test_empty_rows(self):
|
|
"""Empty input returns empty list."""
|
|
result = _normalize_preview_rows([])
|
|
assert result == [""]
|
|
|
|
def test_strips_left_padding(self):
|
|
"""Left padding is stripped."""
|
|
result = _normalize_preview_rows([" content", " more"])
|
|
assert all(not r.startswith(" ") for r in result)
|
|
|
|
def test_preserves_content(self):
|
|
"""Content is preserved."""
|
|
result = _normalize_preview_rows([" hello world "])
|
|
assert "hello world" in result[0]
|
|
|
|
def test_handles_all_empty_rows(self):
|
|
"""All empty rows returns single empty string."""
|
|
result = _normalize_preview_rows(["", " ", ""])
|
|
assert result == [""]
|
|
|
|
|
|
class TestAppConstants:
|
|
"""Tests for app module constants."""
|
|
|
|
def test_title_defined(self):
|
|
"""TITLE is defined."""
|
|
from engine.app import TITLE
|
|
|
|
assert len(TITLE) > 0
|
|
|
|
def test_title_lines_are_strings(self):
|
|
"""TITLE contains string lines."""
|
|
from engine.app import TITLE
|
|
|
|
assert all(isinstance(line, str) for line in TITLE)
|
|
|
|
|
|
class TestAppImports:
|
|
"""Tests for app module imports."""
|
|
|
|
def test_app_imports_without_error(self):
|
|
"""Module imports without error."""
|
|
from engine import app
|
|
|
|
assert app is not None
|