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): from teilchensammler_cli.main import app 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