File tree Expand file tree Collapse file tree 5 files changed +44
-3
lines changed Expand file tree Collapse file tree 5 files changed +44
-3
lines changed Original file line number Diff line number Diff line change 3
3
import pytest_asyncio
4
4
5
5
6
- @pytest_asyncio .fixture (scope = "session" )
6
+ @pytest_asyncio .fixture (scope = "session" , autouse = True )
7
7
def event_loop ():
8
- loop = asyncio .new_event_loop ()
8
+ loop = asyncio .get_event_loop_policy (). get_event_loop ()
9
9
yield loop
10
- loop .run_until_complete (asyncio .sleep (1 ))
10
+ loop .run_until_complete (asyncio .sleep (0.025 ))
11
11
loop .close ()
Original file line number Diff line number Diff line change
1
+ import pytest
1
2
import pytest_asyncio
2
3
3
4
from shazamio import Serialize
@@ -250,6 +251,7 @@ def song_response():
250
251
yield response
251
252
252
253
254
+ @pytest .mark .asyncio
253
255
async def test_recognize_song_bug (song_response : bytes ):
254
256
serialize_out = Serialize .full_track (data = song_response )
255
257
assert serialize_out .matches [0 ].channel is None
Original file line number Diff line number Diff line change
1
+ import pytest
2
+
3
+ from shazamio import Serialize
4
+ from shazamio import Shazam
5
+ from shazamio .schemas .artists import ArtistQuery
6
+ from shazamio .schemas .enums import ArtistExtend
7
+ from shazamio .schemas .enums import ArtistView
8
+
9
+
10
+ @pytest .mark .asyncio
11
+ async def test_about_artist ():
12
+ shazam = Shazam (language = "ES" )
13
+ artist_id = 659860538
14
+
15
+ about_artist = await shazam .artist_about (
16
+ artist_id ,
17
+ query = ArtistQuery (
18
+ views = [
19
+ ArtistView .FULL_ALBUMS ,
20
+ ArtistView .LATEST_RELEASE ,
21
+ ],
22
+ extend = [
23
+ ArtistExtend .ARTIST_BIO ,
24
+ ArtistExtend .BORN_OF_FORMED ,
25
+ ArtistExtend .EDITORIAL_ARTWORK ,
26
+ ArtistExtend .ORIGIN ,
27
+ ],
28
+ ),
29
+ )
30
+
31
+ serialized = Serialize .artist_v2 (about_artist )
32
+ assert serialized .data [0 ].attributes .name == "Markul"
33
+ assert "Hip-hop/Rap" in serialized .data [0 ].attributes .genre_names
Original file line number Diff line number Diff line change
1
+ import pytest
1
2
from pydub import AudioSegment
2
3
from typing import List
3
4
@@ -35,6 +36,7 @@ def do_peak_spreading_non_numpy(self):
35
36
pass
36
37
37
38
39
+ @pytest .mark .asyncio
38
40
async def test_do_peak_spreading_numpy ():
39
41
audio = AudioSegment .from_file (file = "examples/data/dora.ogg" )
40
42
Original file line number Diff line number Diff line change
1
+ import pytest
1
2
import pytest_asyncio
2
3
from pydub import AudioSegment
3
4
from io import BytesIO
@@ -11,6 +12,7 @@ async def song_bytes():
11
12
yield await get_file_bytes (file = "examples/data/dora.ogg" )
12
13
13
14
15
+ @pytest .mark .asyncio
14
16
async def test_recognize_song_file ():
15
17
shazam = Shazam ()
16
18
out = await shazam .recognize_song (data = "examples/data/dora.ogg" )
@@ -19,6 +21,7 @@ async def test_recognize_song_file():
19
21
assert out ["track" ]["key" ] == "549679333"
20
22
21
23
24
+ @pytest .mark .asyncio
22
25
async def test_recognize_song_bytes (song_bytes : bytes ):
23
26
shazam = Shazam ()
24
27
out = await shazam .recognize_song (data = song_bytes )
@@ -27,6 +30,7 @@ async def test_recognize_song_bytes(song_bytes: bytes):
27
30
assert out ["track" ]["key" ] == "549679333"
28
31
29
32
33
+ @pytest .mark .asyncio
30
34
async def test_recognize_song_too_short ():
31
35
short_audio_segment = AudioSegment .from_file (
32
36
file = BytesIO (b"0" * 126 ),
You can’t perform that action at this time.
0 commit comments