codestyle: fiddle with type hints and LSP hints
This commit is contained in:
parent
6b15d2d85c
commit
e348748a5c
2 changed files with 8 additions and 4 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
from typing import Any
|
||||||
|
from sqlmodel.sql.expression import Select
|
||||||
import logging
|
import logging
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
|
@ -91,7 +93,9 @@ async def load_initial_data(engine) -> Sequence[Teilchen]:
|
||||||
List of Teilchen, potentially empty
|
List of Teilchen, potentially empty
|
||||||
"""
|
"""
|
||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
statement = select(Teilchen.id, Teilchen.name, Teilchen.description, Teilchen.tags) # ty:ignore[no-matching-overload]
|
statement: Select[Any] = select(
|
||||||
|
Teilchen.id, Teilchen.name, Teilchen.description, Teilchen.tags
|
||||||
|
)
|
||||||
all_teilchen = session.exec(statement).all()
|
all_teilchen = session.exec(statement).all()
|
||||||
|
|
||||||
logger.debug("Loading initial data: found %s records", len(all_teilchen))
|
logger.debug("Loading initial data: found %s records", len(all_teilchen))
|
||||||
|
|
|
||||||
6
tests.py
6
tests.py
|
|
@ -1,12 +1,12 @@
|
||||||
from teilchensammler_cli.database import create_db_and_tables
|
|
||||||
from sqlalchemy.sql import text
|
|
||||||
import uuid
|
import uuid
|
||||||
from typing import Generator
|
from typing import Generator
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from sqlalchemy import Engine
|
from sqlalchemy import Engine
|
||||||
|
from sqlalchemy.sql import text
|
||||||
from sqlmodel import Session, SQLModel, create_engine
|
from sqlmodel import Session, SQLModel, create_engine
|
||||||
|
|
||||||
|
from teilchensammler_cli.database import create_db_and_tables
|
||||||
from teilchensammler_cli.models import (
|
from teilchensammler_cli.models import (
|
||||||
Teilchen,
|
Teilchen,
|
||||||
TeilchenCreate,
|
TeilchenCreate,
|
||||||
|
|
@ -46,7 +46,7 @@ def TC(**kwargs) -> TeilchenCreate | None:
|
||||||
"""
|
"""
|
||||||
if kwargs:
|
if kwargs:
|
||||||
arguments = empty_teilchen_data | kwargs
|
arguments = empty_teilchen_data | kwargs
|
||||||
return TeilchenCreate(**arguments) # ty:ignore[invalid-argument-type]
|
return TeilchenCreate(**arguments)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue