(
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,
)
| 25 | |
| 26 | |
| 27 | def 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 | |
| 62 | def assert_not_track(tmp_path: Path, expected_name: str) -> None: |
no outgoing calls