Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tests/test_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ def test_user_list():
instancetypes = (Movie, TVShow, TVSeason, TVEpisode, Person)
assert all([isinstance(k, instancetypes) for k in l])

# len() agrees with what iteration yields
assert len(l) == len(list(l))

# PUT to add and remove items from list
l.add_items()
for k, v in data.items():
Expand Down
4 changes: 4 additions & 0 deletions trakt/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ def __iter__(self):
"""Iterate over the items in this user list"""
return self._items.__iter__()

def __len__(self):
"""Return the number of items in this user list"""
return len(self._items)

@classmethod
@post
def create(cls, name, creator, description=None, privacy='private',
Expand Down