fix typecheck errors in test_book_service.py

This commit is contained in:
2026-03-07 12:17:29 -05:00
parent 8117f0dbfe
commit 3a5ea1d158

View File

@@ -1,10 +1,6 @@
"""Tests for BookService"""
import pytest
from pathlib import Path
import aiofiles.os as aios
from chitai.schemas import BookCreate
@@ -29,16 +25,17 @@ class TestBookServiceCRUD:
)
book = await books_service.to_model_on_create(book_data.model_dump())
assert isinstance(book, m.Book)
# Add path manually as it won't be generated (not using the create function, but manually inserting into db)
book.path = f"{test_library.root_path}/J.R.R Tolkien/The Fellowship of the Ring"
await aios.makedirs(book.path)
await aios.makedirs(book.path) # type: ignore[arg-type]
books_service.repository.session.add(book)
await books_service.repository.session.commit()
await books_service.repository.session.refresh(book)
await books_service.update(
await books_service.update_book(
book.id,
{
"title": "The Fellowship of the Ring",
@@ -66,9 +63,7 @@ class TestBookServiceCRUD:
assert updated_book.identifiers[0].value == "9780261102354"
assert updated_book.edition == 3
assert updated_book.publisher is not None
assert updated_book.publisher.name == "Tolkien Estate"
assert len(updated_book.tags) == 2
# book = await books_service.create(book_data.model_dump())