Replace unittest with pytest
This commit is contained in:
parent
1160ee1513
commit
aae4bb3693
10 changed files with 253 additions and 305 deletions
|
@ -2,8 +2,6 @@
|
|||
"""
|
||||
Integration (not unit) tests for pylast.py
|
||||
"""
|
||||
import unittest
|
||||
|
||||
import pylast
|
||||
|
||||
from .test_pylast import TestPyLastWithLastFm
|
||||
|
@ -18,8 +16,8 @@ class TestPyLastAlbum(TestPyLastWithLastFm):
|
|||
tags = album.get_top_tags(limit=1)
|
||||
|
||||
# Assert
|
||||
self.assertGreater(len(tags), 0)
|
||||
self.assertIsInstance(tags[0], pylast.TopItem)
|
||||
assert len(tags) > 0
|
||||
assert isinstance(tags[0], pylast.TopItem)
|
||||
|
||||
def test_album_is_hashable(self):
|
||||
# Arrange
|
||||
|
@ -37,7 +35,7 @@ class TestPyLastAlbum(TestPyLastWithLastFm):
|
|||
track = lastfm_user.get_recent_tracks(limit=2)[0]
|
||||
|
||||
# Assert
|
||||
self.assertTrue(hasattr(track, "album"))
|
||||
assert hasattr(track, "album")
|
||||
|
||||
def test_album_wiki_content(self):
|
||||
# Arrange
|
||||
|
@ -47,8 +45,8 @@ class TestPyLastAlbum(TestPyLastWithLastFm):
|
|||
wiki = album.get_wiki_content()
|
||||
|
||||
# Assert
|
||||
self.assertIsNotNone(wiki)
|
||||
self.assertGreaterEqual(len(wiki), 1)
|
||||
assert wiki is not None
|
||||
assert len(wiki) >= 1
|
||||
|
||||
def test_album_wiki_published_date(self):
|
||||
# Arrange
|
||||
|
@ -58,8 +56,8 @@ class TestPyLastAlbum(TestPyLastWithLastFm):
|
|||
wiki = album.get_wiki_published_date()
|
||||
|
||||
# Assert
|
||||
self.assertIsNotNone(wiki)
|
||||
self.assertGreaterEqual(len(wiki), 1)
|
||||
assert wiki is not None
|
||||
assert len(wiki) >= 1
|
||||
|
||||
def test_album_wiki_summary(self):
|
||||
# Arrange
|
||||
|
@ -69,8 +67,8 @@ class TestPyLastAlbum(TestPyLastWithLastFm):
|
|||
wiki = album.get_wiki_summary()
|
||||
|
||||
# Assert
|
||||
self.assertIsNotNone(wiki)
|
||||
self.assertGreaterEqual(len(wiki), 1)
|
||||
assert wiki is not None
|
||||
assert len(wiki) >= 1
|
||||
|
||||
def test_album_eq_none_is_false(self):
|
||||
# Arrange
|
||||
|
@ -78,7 +76,7 @@ class TestPyLastAlbum(TestPyLastWithLastFm):
|
|||
album2 = pylast.Album("Test Artist", "Test Album", self.network)
|
||||
|
||||
# Act / Assert
|
||||
self.assertNotEqual(album1, album2)
|
||||
assert album1 != album2
|
||||
|
||||
def test_album_ne_none_is_true(self):
|
||||
# Arrange
|
||||
|
@ -86,7 +84,7 @@ class TestPyLastAlbum(TestPyLastWithLastFm):
|
|||
album2 = pylast.Album("Test Artist", "Test Album", self.network)
|
||||
|
||||
# Act / Assert
|
||||
self.assertNotEqual(album1, album2)
|
||||
assert album1 != album2
|
||||
|
||||
def test_get_cover_image(self):
|
||||
# Arrange
|
||||
|
@ -98,7 +96,3 @@ class TestPyLastAlbum(TestPyLastWithLastFm):
|
|||
# Assert
|
||||
self.assert_startswith(image, "https://")
|
||||
self.assert_endswith(image, ".png")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(failfast=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue