Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing limit parameter for track.getSimilar #250

Merged
merged 2 commits into from
Mar 1, 2018

Conversation

redshodan
Copy link

Fixes #249

Changes proposed in this pull request:

  • Add the limit parameter to the track.getSimilar query

@redshodan
Copy link
Author

The build failed with "Invalid API key - You must be granted a valid key by last.fm". I guess something needs updating?

@hugovk
Copy link
Member

hugovk commented Mar 1, 2018

See #171 for why it failed. I'll test locally.

Please could you add unit tests? Something like

def test_love_limits(self):
# Arrange
# Currently test-account has at least 23 loved tracks:
user = self.network.get_user("test-user")
# Act/Assert
self.assertEqual(len(user.get_loved_tracks(limit=20)), 20)
self.assertLessEqual(len(user.get_loved_tracks(limit=100)), 100)
self.assertGreaterEqual(len(user.get_loved_tracks(limit=None)), 23)
self.assertGreaterEqual(len(user.get_loved_tracks(limit=0)), 23)

@redshodan
Copy link
Author

Added. That worked for me, however these two other tests failed. I'm wasn't terribly sure what to put for the lower limit of the tests with no limit, but 23 worked for this Cher song.

TestPyLastAlbum.test_album_in_artist_tracks
TestPyLastUser.test_album_tracks

@hugovk
Copy link
Member

hugovk commented Mar 1, 2018

Thanks, merging!

test_album_in_artist_tracks passes for me, but test_album_tracks also fails on master, so I'll sort those later.

@hugovk hugovk merged commit 6fd8442 into pylast:master Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants