fix(tests): test_api_tags prefix tests use character: not artist: (KNOWN_KINDS dropped artist)

The two prefix-parsing tests were pinned to `artist:Eric`, but `artist`
was removed from KNOWN_KINDS in commit 4cad07a (provenance is a separate
axis from tags). The parser now keeps `artist:` literal, so the assertion
`body["name"] == "Eric"` failed.

Repointed to `character:Saber` (still in KNOWN_KINDS). Also updated the
stale `artist:` docstring example in parse_kind_prefix to `fandom:`.

Caught by [[reference-grep-pinned-tests-in-plans]] — should have grep'd
tests/ for `artist:` when shrinking KNOWN_KINDS. Banking the miss.
This commit is contained in:
2026-05-27 11:09:04 -04:00
parent 74dac6b960
commit 8675f105ad
2 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ def parse_kind_prefix(raw: str) -> tuple[str | None, str]:
parse_kind_prefix("Character:Saber") -> ("character", "Saber")
parse_kind_prefix("sunset") -> (None, "sunset")
parse_kind_prefix("http://example") -> (None, "http://example")
parse_kind_prefix("artist: Eric ") -> ("artist", "Eric")
parse_kind_prefix("fandom: FSN ") -> ("fandom", "FSN")
"""
if ":" in raw:
prefix, rest = raw.split(":", 1)
+6 -6
View File
@@ -75,12 +75,12 @@ async def test_create_tag_name_only_defaults_to_general(client):
@pytest.mark.asyncio
async def test_create_tag_with_kind_prefix(client):
"""IR-style: `name="artist:Eric"` without explicit kind → parsed as artist."""
resp = await client.post("/api/tags", json={"name": "artist:Eric"})
"""IR-style: `name="character:Saber"` without explicit kind → parsed as character."""
resp = await client.post("/api/tags", json={"name": "character:Saber"})
assert resp.status_code == 201
body = await resp.get_json()
assert body["name"] == "Eric"
assert body["kind"] == "artist"
assert body["name"] == "Saber"
assert body["kind"] == "character"
@pytest.mark.asyncio
@@ -88,11 +88,11 @@ async def test_explicit_kind_overrides_prefix_parsing(client):
"""If caller passes explicit kind, don't re-parse the name —
colon and prefix stay literal."""
resp = await client.post(
"/api/tags", json={"name": "artist:Eric", "kind": "general"}
"/api/tags", json={"name": "character:Saber", "kind": "general"}
)
assert resp.status_code == 201
body = await resp.get_json()
assert body["name"] == "artist:Eric"
assert body["name"] == "character:Saber"
assert body["kind"] == "general"