From 3f27d9bd0706eef99a1408bf4c55d648186ed5bc Mon Sep 17 00:00:00 2001 From: Solomon Victorino Date: Thu, 24 Jul 2025 10:23:26 -0600 Subject: [PATCH] update a couple tests - replace deleted albums - `MPREb_TPH4WqN5pUo`'s unavailable tracks are now in the tracklist - handle podcast episodes in video results --- tests/mixins/test_browsing.py | 12 ++++-------- tests/mixins/test_search.py | 4 +++- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/mixins/test_browsing.py b/tests/mixins/test_browsing.py index 9a212e3..e413e04 100644 --- a/tests/mixins/test_browsing.py +++ b/tests/mixins/test_browsing.py @@ -121,19 +121,15 @@ class TestBrowsing: assert album["audioPlaylistId"] is not None assert len(album["tracks"]) == 7 assert len(album["tracks"][0]["artists"]) == 1 - album = yt.get_album("MPREb_rqH94Zr3NN0") + album = yt.get_album("MPREb_7HdnOQMfJ3w") assert album["likeStatus"] is not None assert album["audioPlaylistId"] is not None assert len(album["tracks"][0]["artists"]) == 2 - album = yt.get_album("MPREb_TPH4WqN5pUo") # album with tracks completely removed/missing + album = yt.get_album("MPREb_G21w42zx0qJ") # album with track (#13) disabled/greyed out assert album["likeStatus"] is not None assert album["audioPlaylistId"] is not None - assert album["tracks"][0]["trackNumber"] == 3 - assert album["tracks"][13]["trackNumber"] == 18 - album = yt.get_album("MPREb_YuigcYm2erf") # album with track (#8) disabled/greyed out - assert album["likeStatus"] is not None - assert album["audioPlaylistId"] is not None - assert album["tracks"][7]["trackNumber"] is None + assert album["tracks"][12]["trackNumber"] is None + assert not album["tracks"][12]["isAvailable"] def test_get_album_errors(self, yt): with pytest.raises(Exception, match="Invalid album browseId"): diff --git a/tests/mixins/test_search.py b/tests/mixins/test_search.py index 04f4d83..cc60af6 100644 --- a/tests/mixins/test_search.py +++ b/tests/mixins/test_search.py @@ -81,7 +81,9 @@ class TestSearch: assert all(item["resultType"] == "song" for item in results) results = yt_auth.search(query, filter="videos") assert len(results) > 10 - assert all(item["views"] != "" for item in results) + assert all( + item["views"] != "" for item in results if item["videoType"] != "MUSIC_VIDEO_TYPE_PODCAST_EPISODE" + ) # video results include podcast episodes, which can't track views assert all(item["resultType"] == "video" for item in results) results = yt_auth.search(query, filter="albums", limit=40) assert len(results) > 20