@@ -48,25 +48,29 @@ def test_init(auth_keys):
4848def test_available_voices (auth_keys ):
4949 """Test getting available voices"""
5050 ivona_api = IvonaAPI (auth_keys [0 ], auth_keys [1 ])
51- voices = ivona_api .available_voices
5251
52+ voices = ivona_api .available_voices
5353 assert len (voices ) > 1
5454
5555 # Make sure that default voice is available
5656 assert any ([v ['Name' ] == 'Salli' and v ['Language' ] == 'en-US'
5757 for v in voices ])
5858
5959
60- def test_text_to_speech_custom_voice (auth_keys ):
61- """Test setting custom voice"""
60+ @flaky
61+ def test_available_voices_with_filter (auth_keys ):
62+ """Test getting available voices with filtering"""
6263 ivona_api = IvonaAPI (auth_keys [0 ], auth_keys [1 ])
6364
6465 with pytest .raises (ValueError ):
65- with tempfile .NamedTemporaryFile () as temp_file :
66- ivona_api .text_to_speech (
67- str (uuid4 ()), temp_file ,
68- voice_name = str (uuid4 ()),
69- )
66+ ivona_api .get_available_voices (str (uuid4 ()))
67+
68+ voices = ivona_api .get_available_voices ('en-US' )
69+ assert len (voices ) > 1
70+
71+ # Make sure that default voice is available
72+ assert any ([v ['Name' ] == 'Salli' and v ['Language' ] == 'en-US'
73+ for v in voices ])
7074
7175
7276@flaky
@@ -86,3 +90,15 @@ def test_text_to_speech(auth_keys, voice_name, voice_language, content,
8690 ivona_api .text_to_speech (content , temp_file )
8791
8892 assert filecmp .cmp (org_file , temp_file .name )
93+
94+
95+ def test_text_to_speech_custom_voice (auth_keys ):
96+ """Test setting custom voice"""
97+ ivona_api = IvonaAPI (auth_keys [0 ], auth_keys [1 ])
98+
99+ with pytest .raises (ValueError ):
100+ with tempfile .NamedTemporaryFile () as temp_file :
101+ ivona_api .text_to_speech (
102+ str (uuid4 ()), temp_file ,
103+ voice_name = str (uuid4 ()),
104+ )
0 commit comments