tests: finally another test!

This commit is contained in:
bronsen 2026-02-19 20:38:29 +01:00
parent b0e7089389
commit 0ae116afa9

View file

@ -1,4 +1,54 @@
from typing import TypedDict
import pytest
import logging
from teilchensammler_cli.models import TeilchenCreate, make_teilchen_input
logger = logging.getLogger(__name__)
def test_initial_layout(snap_compare): def test_initial_layout(snap_compare):
from teilchensammler_cli.main import app from teilchensammler_cli.main import app
assert snap_compare(app, terminal_size=(130, 40)) assert snap_compare(app, terminal_size=(130, 40))
class Teilchen(TypedDict):
"""The things I do for my LSP..."""
name: str
description: str
tags: str
text: str
number: int
empty_teilchen: Teilchen = {
"name": "",
"description": "",
"tags": "",
"text": "",
"number": 1,
}
@pytest.mark.parametrize(
"example_input,expected",
[
("", None),
("a", None),
("a.", {"name": "a", "text": "a."}),
("aa", None),
("aa.", {"name": "aa", "text": "aa."}),
],
)
async def test_teilchendata_must_include_period(
example_input: str, expected: dict[str, str | int] | None
) -> None:
thing = expected
if expected:
arguments = empty_teilchen | expected
thing = TeilchenCreate(**arguments) # ty:ignore[invalid-argument-type]
assert await make_teilchen_input(example_input) == thing