@@ -48,25 +48,29 @@ def test_init(auth_keys):
48
48
def test_available_voices (auth_keys ):
49
49
"""Test getting available voices"""
50
50
ivona_api = IvonaAPI (auth_keys [0 ], auth_keys [1 ])
51
- voices = ivona_api .available_voices
52
51
52
+ voices = ivona_api .available_voices
53
53
assert len (voices ) > 1
54
54
55
55
# Make sure that default voice is available
56
56
assert any ([v ['Name' ] == 'Salli' and v ['Language' ] == 'en-US'
57
57
for v in voices ])
58
58
59
59
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"""
62
63
ivona_api = IvonaAPI (auth_keys [0 ], auth_keys [1 ])
63
64
64
65
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 ])
70
74
71
75
72
76
@flaky
@@ -86,3 +90,15 @@ def test_text_to_speech(auth_keys, voice_name, voice_language, content,
86
90
ivona_api .text_to_speech (content , temp_file )
87
91
88
92
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