beatport: GENRES + list_genres() con test

This commit is contained in:
luciano committed 2026-07-14 16:17:09 +02:00
1 parent e1aaa83fe9
commit 70cdfe8983
2 files changed
+85

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
"""Test per core.beatport."""
from __future__ import annotations
import pytest
from core import beatport
class TestListGenres:
def test_returns_list_of_dicts(self):
result = beatport.list_genres()
assert isinstance(result, list)
assert len(result) >= 10 # almeno 10 generi
for g in result:
assert set(g.keys()) == {"slug", "id", "name"}
assert isinstance(g["slug"], str) and g["slug"]
assert isinstance(g["id"], int) and g["id"] > 0
assert isinstance(g["name"], str) and g["name"]
def test_sorted_alphabetically_by_name(self):
result = beatport.list_genres()
names = [g["name"] for g in result]
assert names == sorted(names, key=str.casefold)
def test_melodic_house_techno_present(self):
result = beatport.list_genres()
slugs = [g["slug"] for g in result]
assert "melodic-house-techno" in slugs