@@ -43,7 +43,7 @@ def _get_utterances(self, directory):
43
43
return utterances
44
44
45
45
def _assert_dubbing_action (self , directory ):
46
- operating = platform .system ().lower ()
46
+ # operating = platform.system().lower()
47
47
utterances = self ._get_utterances (directory )
48
48
text_array = [entry ["translated_text" ] for entry in utterances ]
49
49
@@ -56,81 +56,46 @@ def _assert_dubbing_action(self, directory):
56
56
ends = [entry ["end" ] for entry in utterances ]
57
57
speeds = [entry ["speed" ] for entry in utterances ]
58
58
59
- if operating == "darwin" :
60
- assert 4 == len (utterances )
61
-
62
- assert np .allclose (
63
- [
64
- 1.26284375 ,
65
- 2.44409375 ,
66
- 5.24534375 ,
67
- 7.607843750000001 ,
68
- ],
69
- starts ,
70
- atol = 0.5 ,
71
- ), "Utterance start check failed"
72
-
73
- assert np .allclose (
74
- [
75
- 2.17409375 ,
76
- 3.94596875 ,
77
- 6.61221875 ,
78
- 8.687843750000003 ,
79
- ],
80
- ends ,
81
- atol = 0.5 ,
82
- ), "Utterance end check failed"
83
-
84
- assert "- Bon dia. - Bé." == text_array [0 ], "translated text 0"
85
- assert "Em dic Jordi Mas." == text_array [1 ], "translated text 1"
86
- assert "Sóc de Barcelona." == text_array [2 ], "translated text 2"
87
- assert "I m'encanta aquesta ciutat." == text_array [3 ], "translated text 3"
88
-
89
- else :
90
- assert 3 == len (utterances )
91
-
92
- assert np .allclose (
93
- [
94
- 1.26284375 ,
95
- 5.24534375 ,
96
- 7.607843750000001 ,
97
- ],
98
- starts ,
99
- atol = 0.5 ,
100
- ), "Utterance start check failed"
101
-
102
- assert np .allclose (
103
- [
104
- 3.94596875 ,
105
- 6.629093750000001 ,
106
- 8.687843750000003 ,
107
- ],
108
- ends ,
109
- atol = 0.5 ,
110
- ), "Utterance end check failed"
111
-
112
- assert np .allclose (
113
- [1.0 , 1.0 , 1.3 ], speeds , atol = 2
114
- ), "Utterance speed check failed"
115
-
116
- assert "Bon dia, em dic Jordi Mas." == text_array [0 ], "translated text 0"
117
- assert "Sóc de Barcelona." == text_array [1 ], "translated text 1"
118
- assert "I m'encanta aquesta ciutat." == text_array [2 ], "translated text 2"
59
+ print (f"starts: { starts } " )
60
+
61
+ assert np .allclose (
62
+ [
63
+ 1.26284375 ,
64
+ 5.24534375 ,
65
+ 7.607843750000001 ,
66
+ ],
67
+ starts ,
68
+ atol = 0.5 ,
69
+ ), "Utterance start check failed"
70
+
71
+ print (f"ends: { ends } " )
72
+ assert np .allclose (
73
+ [
74
+ 3.94596875 ,
75
+ 6.629093750000001 ,
76
+ 8.687843750000003 ,
77
+ ],
78
+ ends ,
79
+ atol = 0.5 ,
80
+ ), "Utterance end check failed"
81
+
82
+ print (f"speeds: { speeds } " )
83
+ assert np .allclose (
84
+ [1.0 , 1.0 , 1.3 ], speeds , atol = 2
85
+ ), "Utterance speed check failed"
86
+
87
+ assert "Bon dia, em dic Jordi Mas." == text_array [0 ], "translated text 0"
88
+ assert "Sóc de Barcelona." == text_array [1 ], "translated text 1"
89
+ assert "I m'encanta aquesta ciutat." == text_array [2 ], "translated text 2"
119
90
120
91
def _assert_update_action (self , directory ):
121
92
operating = platform .system ().lower ()
122
93
utterances = self ._get_utterances (directory )
123
94
text_array = [entry ["translated_text" ] for entry in utterances ]
124
95
125
- if operating == "darwin" :
126
- assert (
127
- "I m'encanta aquesta ciutat tant meva." == text_array [3 ]
128
- ), "updated translated text 2"
129
-
130
- else :
131
- assert (
132
- "I m'encanta aquesta ciutat tant meva." == text_array [2 ]
133
- ), "updated translated text 2"
96
+ assert (
97
+ "I m'encanta aquesta ciutat tant meva." == text_array [2 ]
98
+ ), "updated translated text 2"
134
99
135
100
@pytest .mark .parametrize ("tts_engine" , ["edge" , "mms" ])
136
101
def test_translations_with_tts (self , tts_engine ):
0 commit comments