diff --git a/tests/test_services_snippets.py b/tests/test_services_snippets.py index 31ad56f..e6f364b 100644 --- a/tests/test_services_snippets.py +++ b/tests/test_services_snippets.py @@ -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(): """The two representations must agree — they're written together, and a disagreement would make a snippet read one way and query another.""" - fields = dict(name="debounce", when_to_use="rate-limit a callback", - signature="debounce(fn, ms)", language="ts") + name, when, sig, lang = ("debounce", "rate-limit a callback", + "debounce(fn, ms)", "ts") locs = [{"repo": "web", "path": "src/util.ts", "symbol": "debounce"}] - from_body = s.snippet_fields(_Note( - title=s.compose_title(fields["name"], fields["when_to_use"]), - body=s.compose_body(code="const x = 1", locations=locs, **fields), - tags=s.compose_tags(fields["language"]), - )) + # compose_body takes no `name` — the name lives in the title — so the two + # serializers get their own argument lists rather than a shared spread. + title = s.compose_title(name, when) + 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( - title=s.compose_title(fields["name"], fields["when_to_use"]), - body=s.compose_body(code="const x = 1", locations=locs, **fields), - tags=s.compose_tags(fields["language"]), - data=s.compose_data(locations=locs, **fields), + title=title, body=body, tags=tags, + data=s.compose_data(name=name, when_to_use=when, signature=sig, + language=lang, locations=locs), )) for key in ("name", "when_to_use", "signature", "language", "locations", "repo", "path", "symbol", "code"):