Skip to content

Commit 011038c

Browse files
test(tests): enhance PDF handling tests and fix assertions
- Updated the assertion in `test_get_with_pdf_with_gemini_model` to check for a more specific response. - Added a new test `test_get_with_pdf_too_large_with_default_model` to verify that a `NotImplementedError` is raised when attempting to process a large PDF with the default model, which does not support PDF processing.
1 parent 21cd154 commit 011038c

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

tests/e2e/agent/test_get.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def test_get_with_pdf_with_gemini_model(
7878
model=model,
7979
)
8080
assert isinstance(response, str)
81-
assert "is a test page " in response.lower()
81+
assert "is a test " in response.lower()
8282

8383

8484
@pytest.mark.parametrize(
@@ -106,6 +106,27 @@ def test_get_with_pdf_too_large(
106106
)
107107

108108

109+
def test_get_with_pdf_too_large_with_default_model(
110+
vision_agent: VisionAgent,
111+
path_fixtures_dummy_pdf: pathlib.Path,
112+
mocker: MockerFixture,
113+
) -> None:
114+
mocker.patch(
115+
"askui.models.askui.google_genai_api.MAX_FILE_SIZE_BYTES",
116+
1,
117+
)
118+
119+
# This should raise a ValueError because the default model is Gemini and it falls
120+
# back to inference askui which does not support pdfs
121+
with pytest.raises(
122+
NotImplementedError, match="PDF processing is not supported for the model"
123+
):
124+
vision_agent.get(
125+
"What is in the PDF?",
126+
source=path_fixtures_dummy_pdf,
127+
)
128+
129+
109130
def test_get_with_model_composition_should_use_default_model(
110131
agent_toolbox_mock: AgentToolbox,
111132
askui_facade: ModelFacade,

0 commit comments

Comments
 (0)