-
Notifications
You must be signed in to change notification settings - Fork 25
/
tests.py
62 lines (37 loc) · 1.36 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"""Some simple tests for geting notifed for API changes of the providers"""
import os
import syncedlyrics
import logging
logging.basicConfig(level=logging.DEBUG)
q = os.getenv("TEST_Q", "bad guy billie eilish")
def _test_provider(provider: str, **kwargs):
lrc = syncedlyrics.search(search_term=q, providers=[provider], **kwargs)
logging.debug(lrc)
assert isinstance(lrc, str)
return lrc
def test_netease():
_test_provider("NetEase")
def test_musixmatch():
_test_provider("Musixmatch")
def test_musixmatch_translation():
lrc = _test_provider("Musixmatch", lang="es")
# not only testing there is a result, but the translation is also included
assert syncedlyrics.utils.has_translation(lrc)
def test_musixmatch_enhanced():
_test_provider("Musixmatch", enhanced=True)
def test_lrclib():
_test_provider("Lrclib")
def test_genius():
_test_provider("Genius")
def test_plaintext_only():
lrc = _test_provider("Lrclib", plain_only=True)
assert syncedlyrics.utils.identify_lyrics_type(lrc) == "plaintext"
def test_synced_only():
lrc = _test_provider("Lrclib", synced_only=True)
assert syncedlyrics.utils.identify_lyrics_type(lrc) == "synced"
# Not working (at least temporarily)
# def test_deezer():
# _test_provider("Deezer")
# Fails randomly on CI
# def test_megalobiz():
# _test_provider("Megalobiz")