test(snippets): fix the round-trip test's shared kwargs spread
CI & Build / Python lint (push) Successful in 2s
CI & Build / TypeScript typecheck (push) Successful in 10s
CI & Build / integration (push) Successful in 20s
CI & Build / Python tests (push) Successful in 43s
CI & Build / Build & push image (push) Successful in 1m5s
CI & Build / Python lint (push) Successful in 2s
CI & Build / TypeScript typecheck (push) Successful in 10s
CI & Build / integration (push) Successful in 20s
CI & Build / Python tests (push) Successful in 43s
CI & Build / Build & push image (push) Successful in 1m5s
Run 2923: 1 failed, 408 passed. My test bug, not a code one — I spread one `fields` dict into both compose_body and compose_data, but compose_body takes no `name` (the name lives in the title). Each serializer now gets its own argument list. The migration itself was fine: the integration lane ran 0001→0070 on pgvector/pg17 green. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RLwAaV4DQEmVyn496HnEvt
This commit is contained in:
@@ -228,19 +228,21 @@ def test_snippet_fields_falls_back_to_the_body_when_data_is_absent():
|
|||||||
def test_data_and_body_round_trip_to_the_same_fields():
|
def test_data_and_body_round_trip_to_the_same_fields():
|
||||||
"""The two representations must agree — they're written together, and a
|
"""The two representations must agree — they're written together, and a
|
||||||
disagreement would make a snippet read one way and query another."""
|
disagreement would make a snippet read one way and query another."""
|
||||||
fields = dict(name="debounce", when_to_use="rate-limit a callback",
|
name, when, sig, lang = ("debounce", "rate-limit a callback",
|
||||||
signature="debounce(fn, ms)", language="ts")
|
"debounce(fn, ms)", "ts")
|
||||||
locs = [{"repo": "web", "path": "src/util.ts", "symbol": "debounce"}]
|
locs = [{"repo": "web", "path": "src/util.ts", "symbol": "debounce"}]
|
||||||
from_body = s.snippet_fields(_Note(
|
# compose_body takes no `name` — the name lives in the title — so the two
|
||||||
title=s.compose_title(fields["name"], fields["when_to_use"]),
|
# serializers get their own argument lists rather than a shared spread.
|
||||||
body=s.compose_body(code="const x = 1", locations=locs, **fields),
|
title = s.compose_title(name, when)
|
||||||
tags=s.compose_tags(fields["language"]),
|
body = s.compose_body(code="const x = 1", language=lang, signature=sig,
|
||||||
))
|
when_to_use=when, locations=locs)
|
||||||
|
tags = s.compose_tags(lang)
|
||||||
|
|
||||||
|
from_body = s.snippet_fields(_Note(title=title, body=body, tags=tags))
|
||||||
from_data = s.snippet_fields(_Note(
|
from_data = s.snippet_fields(_Note(
|
||||||
title=s.compose_title(fields["name"], fields["when_to_use"]),
|
title=title, body=body, tags=tags,
|
||||||
body=s.compose_body(code="const x = 1", locations=locs, **fields),
|
data=s.compose_data(name=name, when_to_use=when, signature=sig,
|
||||||
tags=s.compose_tags(fields["language"]),
|
language=lang, locations=locs),
|
||||||
data=s.compose_data(locations=locs, **fields),
|
|
||||||
))
|
))
|
||||||
for key in ("name", "when_to_use", "signature", "language", "locations",
|
for key in ("name", "when_to_use", "signature", "language", "locations",
|
||||||
"repo", "path", "symbol", "code"):
|
"repo", "path", "symbol", "code"):
|
||||||
|
|||||||
Reference in New Issue
Block a user