fix(types): resolve pre-existing basedpyright errors in tests

Fix ~790 basedpyright errors across the test suite:
- Type stub subclasses of real production classes with super().__init__()
- Add missing generic type arguments and Dict[str, Any] annotations
- Add None guards before subscript/member access
- Adapt tests to production API changes (removed dead handlers,
  PersistentModelCache.get_default, _i18n_filter_added location)
This commit is contained in:
Will Miao
2026-08-08 20:12:59 +08:00
parent 8e724538bd
commit d2f955266d
95 changed files with 953 additions and 666 deletions

View File

@@ -1,5 +1,5 @@
from pathlib import Path
from typing import Any
from typing import Any, Dict, List
import pytest
@@ -55,7 +55,7 @@ async def test_ensure_preview_prefers_rewritten_civitai_image(tmp_path):
exif_utils=exif_utils,
)
images = [
images: List[Dict[str, object]] = [
{
"url": "https://image.civitai.com/container/example/original=true/sample.jpeg",
"type": "image",
@@ -115,7 +115,7 @@ async def test_ensure_preview_falls_back_to_webp_when_rewrite_fails(tmp_path):
exif_utils=exif_utils,
)
images = [
images: List[Dict[str, object]] = [
{
"url": "https://image.civitai.com/container/example/original=true/sample.png",
"type": "image",
@@ -165,7 +165,7 @@ async def test_ensure_preview_rewrites_civitai_video(tmp_path):
exif_utils=RecordingExifUtils(),
)
images = [
images: List[Dict[str, object]] = [
{
"url": "https://image.civitai.com/container/example/original=true/sample.mp4",
"type": "video",
@@ -227,7 +227,7 @@ async def test_ensure_preview_respects_blur_setting(monkeypatch, tmp_path):
exif_utils=RecordingExifUtils(),
)
images = [
images: List[Dict[str, object]] = [
{
"url": "https://image.civitai.com/container/example/original=true/nsfw.jpeg",
"type": "image",