MCPcopy
hub / github.com/scdl-org/scdl / assert_track

Function assert_track

tests/utils.py:27–59  ·  view source on GitHub ↗
(
    tmp_path: Path,
    expected_name: str,
    expected_title: str = "testing - test track",
    expected_artist: str = "7x11x13-testing",
    expected_genre: Optional[str] = "Testing",
    expected_artwork_len: Optional[int] = 16136,
    expected_album: Optional[str] = None,
    expected_albumartist: Optional[str] = None,
    expected_tracknumber: Optional[int] = None,
    check_metadata: bool = True,
)

Source from the content-addressed store, hash-verified

25
26
27def assert_track(
28 tmp_path: Path,
29 expected_name: str,
30 expected_title: str = "testing - test track",
31 expected_artist: str = "7x11x13-testing",
32 expected_genre: Optional[str] = "Testing",
33 expected_artwork_len: Optional[int] = 16136,
34 expected_album: Optional[str] = None,
35 expected_albumartist: Optional[str] = None,
36 expected_tracknumber: Optional[int] = None,
37 check_metadata: bool = True,
38) -> None:
39 file = tmp_path / expected_name
40 assert file.exists()
41
42 if check_metadata:
43 f = music_tag.load_file(file)
44 assert f["#length"].value
45 assert f["title"].value == expected_title
46 assert f["artist"].value == expected_artist
47 if expected_genre:
48 assert f["genre"].value == expected_genre
49 if expected_artwork_len is not None:
50 if expected_artwork_len > 0:
51 assert len(f["artwork"].value.data) == expected_artwork_len
52 else:
53 assert not f["artwork"]
54 if expected_album:
55 assert f["album"].value == expected_album
56 if expected_albumartist:
57 assert f["albumartist"].value == expected_albumartist
58 if expected_tracknumber is not None:
59 assert f["tracknumber"].value == expected_tracknumber
60
61
62def assert_not_track(tmp_path: Path, expected_name: str) -> None:

Callers 15

test_tracksFunction · 0.90
test_likesFunction · 0.90
test_commentedFunction · 0.90
test_repostsFunction · 0.90
assert_track_playlist_1Function · 0.90
assert_track_playlist_2Function · 0.90
test_syncFunction · 0.90
test_searchFunction · 0.90
test_search_playlistFunction · 0.90
test_original_downloadFunction · 0.90
test_original_to_stdoutFunction · 0.90
test_mp3_to_stdoutFunction · 0.90

Calls

no outgoing calls

Tested by 15

test_tracksFunction · 0.72
test_likesFunction · 0.72
test_commentedFunction · 0.72
test_repostsFunction · 0.72
assert_track_playlist_1Function · 0.72
assert_track_playlist_2Function · 0.72
test_syncFunction · 0.72
test_searchFunction · 0.72
test_search_playlistFunction · 0.72
test_original_downloadFunction · 0.72
test_original_to_stdoutFunction · 0.72
test_mp3_to_stdoutFunction · 0.72