Skip to content

Commit 1489f6b

Browse files
committed
Merge branch 'main' into pydub
2 parents eb2727a + 4e2b88c commit 1489f6b

File tree

1 file changed

+35
-70
lines changed

1 file changed

+35
-70
lines changed

e2e-tests/cmd_test.py

+35-70
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def _get_utterances(self, directory):
4343
return utterances
4444

4545
def _assert_dubbing_action(self, directory):
46-
operating = platform.system().lower()
46+
# operating = platform.system().lower()
4747
utterances = self._get_utterances(directory)
4848
text_array = [entry["translated_text"] for entry in utterances]
4949

@@ -56,81 +56,46 @@ def _assert_dubbing_action(self, directory):
5656
ends = [entry["end"] for entry in utterances]
5757
speeds = [entry["speed"] for entry in utterances]
5858

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"
11990

12091
def _assert_update_action(self, directory):
12192
operating = platform.system().lower()
12293
utterances = self._get_utterances(directory)
12394
text_array = [entry["translated_text"] for entry in utterances]
12495

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"
13499

135100
@pytest.mark.parametrize("tts_engine", ["edge", "mms"])
136101
def test_translations_with_tts(self, tts_engine):

0 commit comments

Comments
 (0)