Skip to content

Commit

Permalink
test: fix failing timestamp granularities tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedir Zadniprovskyi committed Jan 26, 2025
1 parent 18c4dab commit b57deee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
9 changes: 4 additions & 5 deletions tests/api_timestamp_granularities_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 6 additions & 7 deletions tests/openai_timestamp_granularities_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b57deee

Please sign in to comment.