autotyping: --none-return: add a -> None return type to functions without any return, yield, or raise in their body
This commit is contained in:
parent
4e5fe31572
commit
6c3f3afb3a
12 changed files with 184 additions and 182 deletions
|
@ -13,7 +13,7 @@ from .test_pylast import WRITE_TEST, TestPyLastWithLastFm
|
|||
|
||||
class TestPyLastTrack(TestPyLastWithLastFm):
|
||||
@pytest.mark.skipif(not WRITE_TEST, reason="Only test once to avoid collisions")
|
||||
def test_love(self):
|
||||
def test_love(self) -> None:
|
||||
# Arrange
|
||||
artist = "Test Artist"
|
||||
title = "test title"
|
||||
|
@ -29,7 +29,7 @@ class TestPyLastTrack(TestPyLastWithLastFm):
|
|||
assert str(loved[0].track.title).lower() == "test title"
|
||||
|
||||
@pytest.mark.skipif(not WRITE_TEST, reason="Only test once to avoid collisions")
|
||||
def test_unlove(self):
|
||||
def test_unlove(self) -> None:
|
||||
# Arrange
|
||||
artist = pylast.Artist("Test Artist", self.network)
|
||||
title = "test title"
|
||||
|
@ -47,7 +47,7 @@ class TestPyLastTrack(TestPyLastWithLastFm):
|
|||
assert str(loved[0].track.artist) != "Test Artist"
|
||||
assert str(loved[0].track.title) != "test title"
|
||||
|
||||
def test_user_play_count_in_track_info(self):
|
||||
def test_user_play_count_in_track_info(self) -> None:
|
||||
# Arrange
|
||||
artist = "Test Artist"
|
||||
title = "test title"
|
||||
|
@ -61,7 +61,7 @@ class TestPyLastTrack(TestPyLastWithLastFm):
|
|||
# Assert
|
||||
assert count >= 0
|
||||
|
||||
def test_user_loved_in_track_info(self):
|
||||
def test_user_loved_in_track_info(self) -> None:
|
||||
# Arrange
|
||||
artist = "Test Artist"
|
||||
title = "test title"
|
||||
|
@ -77,7 +77,7 @@ class TestPyLastTrack(TestPyLastWithLastFm):
|
|||
assert isinstance(loved, bool)
|
||||
assert not isinstance(loved, str)
|
||||
|
||||
def test_track_is_hashable(self):
|
||||
def test_track_is_hashable(self) -> None:
|
||||
# Arrange
|
||||
artist = self.network.get_artist("Test Artist")
|
||||
track = artist.get_top_tracks(stream=False)[0].item
|
||||
|
@ -86,7 +86,7 @@ class TestPyLastTrack(TestPyLastWithLastFm):
|
|||
# Act/Assert
|
||||
self.helper_is_thing_hashable(track)
|
||||
|
||||
def test_track_wiki_content(self):
|
||||
def test_track_wiki_content(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("Test Artist", "test title", self.network)
|
||||
|
||||
|
@ -97,7 +97,7 @@ class TestPyLastTrack(TestPyLastWithLastFm):
|
|||
assert wiki is not None
|
||||
assert len(wiki) >= 1
|
||||
|
||||
def test_track_wiki_summary(self):
|
||||
def test_track_wiki_summary(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("Test Artist", "test title", self.network)
|
||||
|
||||
|
@ -108,7 +108,7 @@ class TestPyLastTrack(TestPyLastWithLastFm):
|
|||
assert wiki is not None
|
||||
assert len(wiki) >= 1
|
||||
|
||||
def test_track_get_duration(self):
|
||||
def test_track_get_duration(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("Cher", "Believe", self.network)
|
||||
|
||||
|
@ -118,7 +118,7 @@ class TestPyLastTrack(TestPyLastWithLastFm):
|
|||
# Assert
|
||||
assert duration >= 200000
|
||||
|
||||
def test_track_get_album(self):
|
||||
def test_track_get_album(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("Nirvana", "Lithium", self.network)
|
||||
|
||||
|
@ -128,7 +128,7 @@ class TestPyLastTrack(TestPyLastWithLastFm):
|
|||
# Assert
|
||||
assert str(album) == "Nirvana - Nevermind"
|
||||
|
||||
def test_track_get_similar(self):
|
||||
def test_track_get_similar(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("Cher", "Believe", self.network)
|
||||
|
||||
|
@ -143,7 +143,7 @@ class TestPyLastTrack(TestPyLastWithLastFm):
|
|||
break
|
||||
assert found
|
||||
|
||||
def test_track_get_similar_limits(self):
|
||||
def test_track_get_similar_limits(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("Cher", "Believe", self.network)
|
||||
|
||||
|
@ -153,7 +153,7 @@ class TestPyLastTrack(TestPyLastWithLastFm):
|
|||
assert len(track.get_similar(limit=None)) >= 23
|
||||
assert len(track.get_similar(limit=0)) >= 23
|
||||
|
||||
def test_tracks_notequal(self):
|
||||
def test_tracks_notequal(self) -> None:
|
||||
# Arrange
|
||||
track1 = pylast.Track("Test Artist", "test title", self.network)
|
||||
track2 = pylast.Track("Test Artist", "Test Track", self.network)
|
||||
|
@ -162,7 +162,7 @@ class TestPyLastTrack(TestPyLastWithLastFm):
|
|||
# Assert
|
||||
assert track1 != track2
|
||||
|
||||
def test_track_title_prop_caps(self):
|
||||
def test_track_title_prop_caps(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("test artist", "test title", self.network)
|
||||
|
||||
|
@ -172,7 +172,7 @@ class TestPyLastTrack(TestPyLastWithLastFm):
|
|||
# Assert
|
||||
assert title == "Test Title"
|
||||
|
||||
def test_track_listener_count(self):
|
||||
def test_track_listener_count(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("test artist", "test title", self.network)
|
||||
|
||||
|
@ -182,7 +182,7 @@ class TestPyLastTrack(TestPyLastWithLastFm):
|
|||
# Assert
|
||||
assert count > 21
|
||||
|
||||
def test_album_tracks(self):
|
||||
def test_album_tracks(self) -> None:
|
||||
# Arrange
|
||||
album = pylast.Album("Test Artist", "Test", self.network)
|
||||
|
||||
|
@ -196,7 +196,7 @@ class TestPyLastTrack(TestPyLastWithLastFm):
|
|||
assert len(tracks) == 1
|
||||
assert url.startswith("https://www.last.fm/music/test")
|
||||
|
||||
def test_track_eq_none_is_false(self):
|
||||
def test_track_eq_none_is_false(self) -> None:
|
||||
# Arrange
|
||||
track1 = None
|
||||
track2 = pylast.Track("Test Artist", "test title", self.network)
|
||||
|
@ -204,7 +204,7 @@ class TestPyLastTrack(TestPyLastWithLastFm):
|
|||
# Act / Assert
|
||||
assert track1 != track2
|
||||
|
||||
def test_track_ne_none_is_true(self):
|
||||
def test_track_ne_none_is_true(self) -> None:
|
||||
# Arrange
|
||||
track1 = None
|
||||
track2 = pylast.Track("Test Artist", "test title", self.network)
|
||||
|
@ -212,7 +212,7 @@ class TestPyLastTrack(TestPyLastWithLastFm):
|
|||
# Act / Assert
|
||||
assert track1 != track2
|
||||
|
||||
def test_track_get_correction(self):
|
||||
def test_track_get_correction(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("Guns N' Roses", "mrbrownstone", self.network)
|
||||
|
||||
|
@ -222,7 +222,7 @@ class TestPyLastTrack(TestPyLastWithLastFm):
|
|||
# Assert
|
||||
assert corrected_track_name == "Mr. Brownstone"
|
||||
|
||||
def test_track_with_no_mbid(self):
|
||||
def test_track_with_no_mbid(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("Static-X", "Set It Off", self.network)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue