From b8773a9e4f4d36cc703956e144f3b5b41b08c8be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Tue, 14 Oct 2025 16:38:49 +0200 Subject: [PATCH] chore: re-add test_unsupported_expires_after_anchor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Han --- tests/unit/providers/files/test_s3_files.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/unit/providers/files/test_s3_files.py b/tests/unit/providers/files/test_s3_files.py index d527ecb47..92a45a9f2 100644 --- a/tests/unit/providers/files/test_s3_files.py +++ b/tests/unit/providers/files/test_s3_files.py @@ -258,6 +258,19 @@ class TestS3FilesImpl: with pytest.raises(ResourceNotFoundError, match="not found"): await s3_provider._get_file(uploaded.id, return_expired=True) + async def test_unsupported_expires_after_anchor(self, s3_provider, sample_text_file): + """Unsupported anchor value should raise ValueError.""" + from llama_stack.apis.files import ExpiresAfter + + sample_text_file.filename = "test_unsupported_expires_after_anchor" + + with pytest.raises(ValueError, match="Input should be 'created_at'"): + await s3_provider.openai_upload_file( + file=sample_text_file, + purpose=OpenAIFilePurpose.ASSISTANTS, + expires_after=ExpiresAfter(anchor="now", seconds=3600), # type: ignore + ) + async def test_nonint_expires_after_seconds(self, s3_provider, sample_text_file): """Non-integer seconds in expires_after should raise ValueError.""" from llama_stack.apis.files import ExpiresAfter