From b57deee5624c0c0c35d238469a08d6bb5eb508b3 Mon Sep 17 00:00:00 2001 From: Fedir Zadniprovskyi Date: Sun, 26 Jan 2025 12:08:28 -0800 Subject: [PATCH] test: fix failing timestamp granularities tests Likely due to https://github.com/openai/openai-python/pull/1757 --- tests/api_timestamp_granularities_test.py | 9 ++++----- tests/openai_timestamp_granularities_test.py | 13 ++++++------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/tests/api_timestamp_granularities_test.py b/tests/api_timestamp_granularities_test.py index 9aa6f6c1..438a413d 100644 --- a/tests/api_timestamp_granularities_test.py +++ b/tests/api_timestamp_granularities_test.py @@ -36,11 +36,10 @@ async def test_api_verbose_json_response_format_and_timestamp_granularities_comb timestamp_granularities=timestamp_granularities, ) - assert transcription.__pydantic_extra__ if "word" in timestamp_granularities: - assert transcription.__pydantic_extra__.get("segments") is not None - assert transcription.__pydantic_extra__.get("words") is not None + assert transcription.segments is not None + assert transcription.words is not None else: # Unless explicitly requested, words are not present - assert transcription.__pydantic_extra__.get("segments") is not None - assert transcription.__pydantic_extra__.get("words") is None + assert transcription.segments is not None + assert transcription.words is None diff --git a/tests/openai_timestamp_granularities_test.py b/tests/openai_timestamp_granularities_test.py index 544f6b65..6337858d 100644 --- a/tests/openai_timestamp_granularities_test.py +++ b/tests/openai_timestamp_granularities_test.py @@ -46,15 +46,14 @@ async def test_openai_verbose_json_response_format_and_timestamp_granularities_c timestamp_granularities=timestamp_granularities, ) - assert transcription.__pydantic_extra__ if timestamp_granularities == ["word"]: # This is an exception where segments are not present - assert transcription.__pydantic_extra__.get("segments") is None - assert transcription.__pydantic_extra__.get("words") is not None + assert transcription.segments is None + assert transcription.words is not None elif "word" in timestamp_granularities: - assert transcription.__pydantic_extra__.get("segments") is not None - assert transcription.__pydantic_extra__.get("words") is not None + assert transcription.segments is not None + assert transcription.words is not None else: # Unless explicitly requested, words are not present - assert transcription.__pydantic_extra__.get("segments") is not None - assert transcription.__pydantic_extra__.get("words") is None + assert transcription.segments is not None + assert transcription.words is None