Skip to content

Commit

Permalink
black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Dronablo committed Aug 27, 2022
1 parent 1e982bb commit 395f7ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion shazamio/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ async def recognize_song(
signature = signature_generator.get_next_signature()

if len(signature_generator.input_pending_processing) < 128:
return {'matches': []}
return {"matches": []}

while not signature:
signature = signature_generator.get_next_signature()
Expand Down
15 changes: 8 additions & 7 deletions tests/test_recognize.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from shazamio.utils import get_file_bytes



@pytest_asyncio.fixture(scope="session")
async def song_bytes():
yield await get_file_bytes(file="examples/data/dora.ogg")
Expand All @@ -29,14 +28,16 @@ async def test_recognize_song_bytes(song_bytes: bytes):


async def test_recognize_song_too_short():
short_audio_segment = AudioSegment.from_file(file=BytesIO(b'0'*126),
format='pcm',
sample_width=2,
frame_rate=16000,
channels=1)
short_audio_segment = AudioSegment.from_file(
file=BytesIO(b"0" * 126),
format="pcm",
sample_width=2,
frame_rate=16000,
channels=1,
)

shazam = Shazam()
out = await shazam.recognize_song(data=short_audio_segment)

assert out.get("matches") == []
assert "track" not in out
assert "track" not in out

0 comments on commit 395f7ed

Please sign in to comment.