mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
feat: exit the Populate function when another one is started
+ add test for the extract_fetured_artists_from_title function
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
from app.utils import extract_featured_artists_from_title
|
||||
|
||||
|
||||
def test_extract_featured_artists_from_title():
|
||||
test_titles = [
|
||||
"Own it (Featuring Ed Sheeran & Stormzy)",
|
||||
"Godzilla (Deluxe)(Feat. Juice Wrld)(Deluxe)",
|
||||
"Simmer (with Burna Boy)",
|
||||
]
|
||||
|
||||
expected_test_artists = [
|
||||
["Ed Sheeran", "Stormzy"],
|
||||
['Juice Wrld'],
|
||||
["Burna Boy"]
|
||||
]
|
||||
|
||||
for title, expected in zip(test_titles, expected_test_artists):
|
||||
assert extract_featured_artists_from_title(title) == expected
|
||||
@@ -0,0 +1,33 @@
|
||||
import app.utils
|
||||
from hypothesis import given, strategies as st
|
||||
from app.utils import extract_featured_artists_from_title
|
||||
|
||||
|
||||
def test_extract_featured_artists_from_title():
|
||||
test_titles = [
|
||||
"Own it (Featuring Ed Sheeran & Stormzy)",
|
||||
"Autograph (On my line)(Feat. Lil Peep)(Deluxe)",
|
||||
"Why so sad? (with Juice Wrld, Lil Peep)",
|
||||
"Why so sad? (with Juice Wrld/Lil Peep)",
|
||||
"Simmer (with Burna Boy)",
|
||||
"Simmer (without Burna Boy)"
|
||||
]
|
||||
|
||||
results = [
|
||||
["Ed Sheeran", "Stormzy"],
|
||||
['Lil Peep'],
|
||||
["Juice Wrld", "Lil Peep"],
|
||||
["Juice Wrld", "Lil Peep"],
|
||||
["Burna Boy"],
|
||||
[]
|
||||
]
|
||||
|
||||
for title, expected in zip(test_titles, results):
|
||||
assert extract_featured_artists_from_title(title) == expected
|
||||
|
||||
|
||||
# === HYPOTHESIS GHOSTWRITER TESTS ===
|
||||
|
||||
@given(__dir=st.text(), full=st.booleans())
|
||||
def test_fuzz_run_fast_scandir(__dir: str, full) -> None:
|
||||
app.utils.run_fast_scandir(_dir=__dir, full=full)
|
||||
Reference in New Issue
Block a user