From 0ae116afa9049b8a2e8e139ff55b7d0181cf5735 Mon Sep 17 00:00:00 2001 From: bronsen Date: Thu, 19 Feb 2026 20:38:29 +0100 Subject: [PATCH] tests: finally another test! --- tests.py | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tests.py b/tests.py index 521a238..0b547c6 100644 --- a/tests.py +++ b/tests.py @@ -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): 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