Type the fake host modules in the tests so mypy passes on them

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-29 19:47:09 +02:00
1 parent 2ff5046993
commit 0448a34ddb
2 files changed
+9 -7

No files matched your search

+4 -2
View File
@@ -6,7 +6,9 @@ from __future__ import annotations
import json
import re
import types
from collections.abc import Set
from pathlib import Path
from typing import Any
import httpx
import pytest
@@ -83,7 +85,7 @@ def test_no_module_of_the_eight_keeps_its_case() -> None:
def test_a_host_that_gains_a_module_replaces_its_unreadable_pattern() -> None:
"""Wave by wave, a host named here becomes readable by its module alone."""
taleo = types.ModuleType("taleo")
taleo: Any = types.ModuleType("taleo")
taleo.PATTERNS = (r"https?://([a-z0-9-]+)\.taleo\.net",)
hosts = mod._hosts({"taleo": taleo}, mod._UNREADABLE)
assert [pattern.pattern for host, pattern in hosts if host == "taleo"] == [
@@ -126,7 +128,7 @@ class Site:
is a page that did not answer. Remembers the order of fetches."""
def __init__(self, pages: dict[str, tuple[str, str] | str],
boards: set[tuple[str, str]] = frozenset()) -> None:
boards: Set[tuple[str, str]] = frozenset()) -> None:
self.pages = {k: (v if isinstance(v, tuple) else (k, v)) for k, v in pages.items()}
self.boards = boards
self.fetched: list[str] = []