Fedir Zadniprovskyi commited on
Commit
2f0c9a2
·
1 Parent(s): 1e15c4e

test: fix failing timestamp granularities tests

Browse files

Likely due to https://github.com/openai/openai-python/pull/1757

tests/api_timestamp_granularities_test.py CHANGED
@@ -36,11 +36,10 @@ async def test_api_verbose_json_response_format_and_timestamp_granularities_comb
36
  timestamp_granularities=timestamp_granularities,
37
  )
38
 
39
- assert transcription.__pydantic_extra__
40
  if "word" in timestamp_granularities:
41
- assert transcription.__pydantic_extra__.get("segments") is not None
42
- assert transcription.__pydantic_extra__.get("words") is not None
43
  else:
44
  # Unless explicitly requested, words are not present
45
- assert transcription.__pydantic_extra__.get("segments") is not None
46
- assert transcription.__pydantic_extra__.get("words") is None
 
36
  timestamp_granularities=timestamp_granularities,
37
  )
38
 
 
39
  if "word" in timestamp_granularities:
40
+ assert transcription.segments is not None
41
+ assert transcription.words is not None
42
  else:
43
  # Unless explicitly requested, words are not present
44
+ assert transcription.segments is not None
45
+ assert transcription.words is None
tests/openai_timestamp_granularities_test.py CHANGED
@@ -46,15 +46,14 @@ async def test_openai_verbose_json_response_format_and_timestamp_granularities_c
46
  timestamp_granularities=timestamp_granularities,
47
  )
48
 
49
- assert transcription.__pydantic_extra__
50
  if timestamp_granularities == ["word"]:
51
  # This is an exception where segments are not present
52
- assert transcription.__pydantic_extra__.get("segments") is None
53
- assert transcription.__pydantic_extra__.get("words") is not None
54
  elif "word" in timestamp_granularities:
55
- assert transcription.__pydantic_extra__.get("segments") is not None
56
- assert transcription.__pydantic_extra__.get("words") is not None
57
  else:
58
  # Unless explicitly requested, words are not present
59
- assert transcription.__pydantic_extra__.get("segments") is not None
60
- assert transcription.__pydantic_extra__.get("words") is None
 
46
  timestamp_granularities=timestamp_granularities,
47
  )
48
 
 
49
  if timestamp_granularities == ["word"]:
50
  # This is an exception where segments are not present
51
+ assert transcription.segments is None
52
+ assert transcription.words is not None
53
  elif "word" in timestamp_granularities:
54
+ assert transcription.segments is not None
55
+ assert transcription.words is not None
56
  else:
57
  # Unless explicitly requested, words are not present
58
+ assert transcription.segments is not None
59
+ assert transcription.words is None