1
- # %%
2
- # import sys
3
- # sys.path.append('../')
4
1
import musicalgestures
5
2
from musicalgestures ._utils import *
6
3
import numpy as np
7
4
import os
8
5
import pytest
9
6
10
- # %%
11
-
12
7
13
8
class Test_MgProgressbar :
14
9
def test_init (self ):
@@ -138,8 +133,44 @@ def testvideo_mp4(tmp_path_factory):
138
133
return testvideo_mp4
139
134
140
135
class Test_convert_to_avi :
136
+ @pytest .mark .xfail (raises = AssertionError )
141
137
def test_output (self , tmp_path , testvideo_mp4 ):
142
138
target_name = str (tmp_path ).replace ("\\ " , "/" ) + "/testvideo_converted.avi"
143
139
testvideo_avi = convert_to_avi (testvideo_mp4 , target_name = target_name )
140
+ length_in = get_length (testvideo_mp4 )
141
+ length_out = get_length (testvideo_avi )
144
142
assert os .path .isfile (testvideo_avi ) == True
143
+ assert os .path .splitext (testvideo_avi )[1 ] == ".avi"
144
+ assert target_name == testvideo_avi
145
+ assert length_in == length_out # this will fail due to ffmpeg bug: https://trac.ffmpeg.org/ticket/9443#ticket
146
+
145
147
148
+ @pytest .fixture (scope = "class" )
149
+ def testvideo_avi (tmp_path_factory ):
150
+ target_name = str (tmp_path_factory .mktemp ("data" )).replace ("\\ " , "/" ) + "/testvideo.avi"
151
+ testvideo_avi = extract_subclip (musicalgestures .examples .dance , 5 , 6 , target_name = target_name )
152
+ return testvideo_avi
153
+
154
+ class Test_convert_to_mp4 :
155
+ def test_output (self , tmp_path , testvideo_avi ):
156
+ target_name = str (tmp_path ).replace ("\\ " , "/" ) + "/testvideo_converted.mp4"
157
+ testvideo_mp4 = convert_to_mp4 (testvideo_avi , target_name = target_name )
158
+ length_in = get_length (testvideo_avi )
159
+ length_out = get_length (testvideo_mp4 )
160
+ assert os .path .isfile (testvideo_mp4 ) == True
161
+ assert os .path .splitext (testvideo_mp4 )[1 ] == ".mp4"
162
+ assert target_name == testvideo_mp4
163
+ assert length_in == length_out
164
+
165
+
166
+ class Test_convert_to_webm :
167
+ @pytest .mark .xfail (raises = AssertionError )
168
+ def test_output (self , tmp_path , testvideo_avi ):
169
+ target_name = str (tmp_path ).replace ("\\ " , "/" ) + "/testvideo_converted.webm"
170
+ testvideo_webm = convert_to_webm (testvideo_avi , target_name = target_name )
171
+ length_in = get_length (testvideo_avi )
172
+ length_out = get_length (testvideo_webm )
173
+ assert os .path .isfile (testvideo_webm ) == True
174
+ assert os .path .splitext (testvideo_webm )[1 ] == ".webm"
175
+ assert target_name == testvideo_webm
176
+ assert length_in == length_out # this will fail, need to find out why
0 commit comments