From 6338a2b511da218a7f6f639e12488ad7b92211e2 Mon Sep 17 00:00:00 2001 From: tehkillerbee Date: Fri, 11 Oct 2024 22:56:45 +0200 Subject: [PATCH] Added misc. page tests. Fixed misc. comments. --- tests/test_page.py | 21 +++++++++++++++++++-- tidalapi/playlist.py | 6 +++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/tests/test_page.py b/tests/test_page.py index 2521c24..98ec827 100644 --- a/tests/test_page.py +++ b/tests/test_page.py @@ -15,7 +15,6 @@ # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . -import pytest import tidalapi @@ -48,6 +47,7 @@ def test_get_explore_items(session): assert first_item.categories[1].title == "Milestone Year Albums" assert first_item.categories[2].title == "Albums Of The Decade" playlist = first_item.categories[0].items[0] + assert isinstance(playlist, tidalapi.Playlist) assert playlist.name # == 'Remember...the 1950s' assert playlist.num_tracks > 1 assert playlist.num_videos == 0 @@ -55,6 +55,7 @@ def test_get_explore_items(session): genre_genres = explore.categories[0].items[1] genre_genres_page_items = iter(genre_genres.get()) playlist = next(genre_genres_page_items) # Usually a playlist + assert isinstance(playlist, tidalapi.Playlist) assert playlist.name # == 'Remember...the 1950s' assert playlist.num_tracks > 1 assert playlist.num_videos == 0 @@ -66,9 +67,25 @@ def test_get_explore_items(session): assert next(iterator).title == "Country" +def test_hires_page(session): + hires = session.hires_page() + first = next(iter(hires)) + assert first.name == "Electronic: Headphone Classics" + assert isinstance(first, tidalapi.Playlist) + + def test_for_you(session): for_you = session.for_you() - assert for_you + first = next(iter(for_you)) + assert first.title == "My Daily Discovery" + assert isinstance(first, tidalapi.Mix) + + +def test_videos(session): + videos = session.videos() + first = next(iter(videos)) + assert first.type == "VIDEO" + assert isinstance(first.get(), tidalapi.Video) def test_show_more(session): diff --git a/tidalapi/playlist.py b/tidalapi/playlist.py index ce3ce3d..f026fae 100644 --- a/tidalapi/playlist.py +++ b/tidalapi/playlist.py @@ -495,8 +495,8 @@ def add( :param allow_duplicates: Allow adding duplicate items :param position: Insert items at a specific position. Default: insert at the end of the playlist - :param position: Maximum number of items to add - :return: True, if successful. + :param limit: Maximum number of items to add + :return: List of media IDs that has been added """ media_ids = list_validate(media_ids) # Insert items at a specific index @@ -535,7 +535,7 @@ def merge( tracks will be skipped. :param allow_missing: If true, missing tracks are allowed. Otherwise, exception will be thrown - :return: + :return: List of items that has been added from the playlist """ data = { "fromPlaylistUuid": str(playlist),