Skip to content

Commit

Permalink
Added misc. page tests. Fixed misc. comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
tehkillerbee committed Oct 11, 2024
1 parent 952abc4 commit 6338a2b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
21 changes: 19 additions & 2 deletions tests/test_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import pytest

import tidalapi

Expand Down Expand Up @@ -48,13 +47,15 @@ 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

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
Expand All @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions tidalapi/playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 6338a2b

Please sign in to comment.