From bb8f054bdaf24883d8026f36f93da0fa112cec42 Mon Sep 17 00:00:00 2001 From: Wagner Lacerda Date: Fri, 16 Oct 2026 22:43:16 -0300 Subject: [PATCH 1/6] fix(tests): wrap long ClaudeAnswerGenerator call in test_api --- tests/test_api.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_api.py b/tests/test_api.py index 4c57f38..008ee46 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -17,7 +17,11 @@ def handler(request: httpx2.Request) -> httpx2.Response: ) mock_http_client = httpx2.AsyncClient(transport=httpx2.MockTransport(handler)) - generator = ClaudeAnswerGenerator(api_key="test-key", model="test-model", client=mock_http_client) + generator = ClaudeAnswerGenerator( + api_key="test-key", + model="test-model", + client=mock_http_client, + ) pipeline = RagPipeline(generator=generator) app = create_app(pipeline=pipeline) return TestClient(app) From 5713aa85af0ba099077e3725197c94c9ad945c34 Mon Sep 17 00:00:00 2001 From: Wagner Lacerda Date: Fri, 16 Oct 2026 22:43:20 -0300 Subject: [PATCH 2/6] fix(tests): wrap long client.post call in test_api --- tests/test_api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_api.py b/tests/test_api.py index 008ee46..f726866 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -44,7 +44,10 @@ def test_querying_before_any_document_is_ingested_returns_no_sources(client): def test_querying_after_ingesting_returns_a_cited_answer(client): - client.post("/documents", json={"document_id": "animals", "text": "Cats are small domesticated mammals."}) + client.post( + "/documents", + json={"document_id": "animals", "text": "Cats are small domesticated mammals."}, + ) response = client.post("/query", json={"question": "Are cats mammals?"}) From ef14eed13a5b1e6e6913facb5985930a79078aeb Mon Sep 17 00:00:00 2001 From: Wagner Lacerda Date: Fri, 16 Oct 2026 22:43:26 -0300 Subject: [PATCH 3/6] fix(tests): wrap long SearchResult lines in test_generation --- tests/test_generation.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/test_generation.py b/tests/test_generation.py index 889fdcf..3b33a9a 100644 --- a/tests/test_generation.py +++ b/tests/test_generation.py @@ -11,8 +11,14 @@ def test_grounded_prompt_includes_every_source_and_the_question(): results = [ - SearchResult(chunk=Chunk(document_id="doc-a", index=0, text="Cats are mammals."), score=0.9), - SearchResult(chunk=Chunk(document_id="doc-b", index=1, text="Dogs are mammals too."), score=0.5), + SearchResult( + chunk=Chunk(document_id="doc-a", index=0, text="Cats are mammals."), + score=0.9, + ), + SearchResult( + chunk=Chunk(document_id="doc-b", index=1, text="Dogs are mammals too."), + score=0.5, + ), ] prompt = build_grounded_prompt("Are cats mammals?", results) From 8223ac8444821dcdb9a6a893a3700f39db102475 Mon Sep 17 00:00:00 2001 From: Wagner Lacerda Date: Fri, 16 Oct 2026 22:43:31 -0300 Subject: [PATCH 4/6] fix(tests): wrap long results list in test_generation --- tests/test_generation.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_generation.py b/tests/test_generation.py index 3b33a9a..ae8df77 100644 --- a/tests/test_generation.py +++ b/tests/test_generation.py @@ -32,7 +32,12 @@ def test_grounded_prompt_includes_every_source_and_the_question(): async def test_generator_sends_the_grounded_prompt_and_returns_the_answer(build_mock_client): captured = {} - results = [SearchResult(chunk=Chunk(document_id="doc-a", index=0, text="Cats are mammals."), score=0.9)] + results = [ + SearchResult( + chunk=Chunk(document_id="doc-a", index=0, text="Cats are mammals."), + score=0.9, + ), + ] def handler(request: httpx2.Request) -> httpx2.Response: captured["headers"] = request.headers From 00db095e54e3809dbc8f476c4d57cc91cd9b2db3 Mon Sep 17 00:00:00 2001 From: Wagner Lacerda Date: Fri, 16 Oct 2026 22:43:36 -0300 Subject: [PATCH 5/6] fix(tests): wrap long Response call in test_generation --- tests/test_generation.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_generation.py b/tests/test_generation.py index ae8df77..fd9ff30 100644 --- a/tests/test_generation.py +++ b/tests/test_generation.py @@ -42,7 +42,10 @@ async def test_generator_sends_the_grounded_prompt_and_returns_the_answer(build_ def handler(request: httpx2.Request) -> httpx2.Response: captured["headers"] = request.headers captured["body"] = json.loads(request.content) - return httpx2.Response(200, json={"content": [{"type": "text", "text": "Yes, cats are mammals [source 1]."}]}) + return httpx2.Response( + 200, + json={"content": [{"type": "text", "text": "Yes, cats are mammals [source 1]."}]}, + ) generator = ClaudeAnswerGenerator( api_key="test-key", model="test-model", client=build_mock_client(handler) From 5208243860ddc121a7df5d5bfedda4a9815bd37e Mon Sep 17 00:00:00 2001 From: Wagner Lacerda Date: Fri, 16 Oct 2026 22:43:41 -0300 Subject: [PATCH 6/6] fix(tests): wrap long Response call in test_pipeline --- tests/test_pipeline.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py index ea62e2f..b27bc92 100644 --- a/tests/test_pipeline.py +++ b/tests/test_pipeline.py @@ -31,7 +31,10 @@ async def test_ingest_reports_how_many_chunks_it_created(): async def test_ask_returns_the_generated_answer_with_matching_sources(): def handler(request: httpx2.Request) -> httpx2.Response: - return httpx2.Response(200, json={"content": [{"type": "text", "text": "Cats are mammals."}]}) + return httpx2.Response( + 200, + json={"content": [{"type": "text", "text": "Cats are mammals."}]}, + ) pipeline = _pipeline_with_generator(handler) pipeline.ingest("animals", "Cats are small domesticated feline mammals.")