Refactor with pytest.mark.parametrize
This commit is contained in:
parent
08274028eb
commit
a5034c43c0
|
@ -95,41 +95,17 @@ class TestPyLastArtist(TestPyLastWithLastFm):
|
||||||
# Assert
|
# Assert
|
||||||
self.helper_two_different_things_in_top_list(things, pylast.Album)
|
self.helper_two_different_things_in_top_list(things, pylast.Album)
|
||||||
|
|
||||||
def test_artist_top_albums_limit_1(self):
|
@pytest.mark.parametrize("test_limit", [1, 50, 100])
|
||||||
|
def test_artist_top_albums_limit(self, test_limit: int) -> None:
|
||||||
# Arrange
|
# Arrange
|
||||||
limit = 1
|
|
||||||
# Pick an artist with plenty of plays
|
# Pick an artist with plenty of plays
|
||||||
artist = self.network.get_top_artists(limit=1)[0].item
|
artist = self.network.get_top_artists(limit=1)[0].item
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
things = artist.get_top_albums(limit=limit)
|
things = artist.get_top_albums(limit=test_limit)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert len(things) == 1
|
assert len(things) == test_limit
|
||||||
|
|
||||||
def test_artist_top_albums_limit_50(self):
|
|
||||||
# Arrange
|
|
||||||
limit = 50
|
|
||||||
# Pick an artist with plenty of plays
|
|
||||||
artist = self.network.get_top_artists(limit=1)[0].item
|
|
||||||
|
|
||||||
# Act
|
|
||||||
things = artist.get_top_albums(limit=limit)
|
|
||||||
|
|
||||||
# Assert
|
|
||||||
assert len(things) == 50
|
|
||||||
|
|
||||||
def test_artist_top_albums_limit_100(self):
|
|
||||||
# Arrange
|
|
||||||
limit = 100
|
|
||||||
# Pick an artist with plenty of plays
|
|
||||||
artist = self.network.get_top_artists(limit=1)[0].item
|
|
||||||
|
|
||||||
# Act
|
|
||||||
things = artist.get_top_albums(limit=limit)
|
|
||||||
|
|
||||||
# Assert
|
|
||||||
assert len(things) == 100
|
|
||||||
|
|
||||||
def test_artist_top_albums_limit_default(self):
|
def test_artist_top_albums_limit_default(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
|
Loading…
Reference in a new issue