progress
This commit is contained in:
44
lyric_search_new/tests.py
Normal file
44
lyric_search_new/tests.py
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env python3.12
|
||||
# tests
|
||||
|
||||
import asyncio
|
||||
import sys
|
||||
import sources.cache, sources.genius, sources.aggregate
|
||||
import utils
|
||||
|
||||
test_artist = "hopsin"
|
||||
test_song = "ill mind of hopsin 5"
|
||||
|
||||
async def test_cache(artist, song):
|
||||
cache = sources.cache.Cache()
|
||||
result = await cache.search(artist, song)
|
||||
if not result:
|
||||
print(f"Could not find {artist} - {song}!")
|
||||
return
|
||||
print(result.dict())
|
||||
|
||||
# print(f"artist: {ret_artist}\nsong: {ret_song}:\n{ret_lyr}")
|
||||
# print(result)
|
||||
|
||||
async def test_genius(artist=None, song=None):
|
||||
if not artist or not song:
|
||||
artist = test_artist
|
||||
song = test_song
|
||||
genius = sources.genius.Genius()
|
||||
result = await genius.search(artist, song)
|
||||
print(result)
|
||||
|
||||
async def test_aggregate(artist=None, song=None):
|
||||
if not artist or not song:
|
||||
artist = test_artist
|
||||
song = test_song
|
||||
aggregate = sources.aggregate.Aggregate()
|
||||
result = await aggregate.search(artist, song)
|
||||
print(result.dict())
|
||||
|
||||
|
||||
|
||||
loop = asyncio.new_event_loop()
|
||||
loop.run_until_complete(test_genius())
|
||||
loop.run_until_complete(test_cache(artist=test_artist, song=test_song))
|
||||
loop.run_until_complete(test_aggregate())
|
Reference in New Issue
Block a user