Skip to content

Commit 9fd9e5a

Browse files
committed
Fix too few blank lines between top level functions
1 parent f9fa9b3 commit 9fd9e5a

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

tests/test_api.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
logging.basicConfig(level=logging.DEBUG)
2727

28+
2829
@pytest.fixture(scope='session')
2930
def session():
3031
session = tidalapi.Session()
@@ -33,28 +34,34 @@ def session():
3334
session.login(username, password)
3435
return session
3536

37+
3638
def test_get_artist(session):
3739
artist_id = 16147
3840
artist = session.get_artist(artist_id)
3941
assert artist.id == artist_id
4042
assert artist.name == 'Lasgo'
4143

44+
4245
def test_get_artist_albums(session):
4346
albums = session.get_artist_albums(16147)
4447
assert albums[0].name == 'Some Things'
4548

49+
4650
def test_get_artist_albums_ep_single(session):
4751
albums = session.get_artist_albums_ep_singles(16147)
4852
assert any([a.name == 'Feeling Alive' for a in albums])
4953

54+
5055
def test_get_artist_albums_other(session):
5156
albums = session.get_artist_albums_other(16147)
5257
assert any([a.name == 'Dance History 1.0' for a in albums])
5358

59+
5460
def test_get_artist_videos(session):
5561
videos = session.get_artist_videos(3502112)
5662
assert any([v.name == 'Call on Me' for v in videos])
5763

64+
5865
def test_get_album(session):
5966
album_id = 17927863
6067
album = session.get_album(album_id)
@@ -66,6 +73,7 @@ def test_get_album(session):
6673
assert album.artist.name == 'Lasgo'
6774
assert album.artists[0].name == 'Lasgo'
6875

76+
6977
def test_get_album_tracks(session):
7078
tracks = session.get_album_tracks(17925106)
7179
assert tracks[0].name == 'Take-Off'
@@ -78,6 +86,7 @@ def test_get_album_tracks(session):
7886
assert tracks[-1].duration == 210
7987
assert tracks[-1].version == 'Acoustic Version'
8088

89+
8190
def test_get_album_videos(session):
8291
videos = session.get_album_videos(108046179)
8392
assert videos[0].name == 'Formation (Choreography Version)'
@@ -89,6 +98,7 @@ def test_get_album_videos(session):
8998
assert videos[1].track_num == 15
9099
assert videos[1].duration == 3955
91100

101+
92102
def test_get_album_items(session):
93103
items = session.get_album_items(108046179)
94104
assert items[0].name == 'Pray You Catch Me'
@@ -101,37 +111,45 @@ def test_get_album_items(session):
101111
assert items[-1].duration == 3955
102112
assert items[-1].type == 'Music Video'
103113

114+
104115
def test_artist_radio(session):
105116
tracks = session.get_artist_radio(16147)
106117
assert tracks
107118

119+
108120
def test_search(session):
109121
res = session.search('artist', 'lasgo')
110122
assert res.artists[0].name == "Lasgo"
111123

124+
112125
def test_artist_picture(session):
113126
artist = session.get_artist(16147)
114127
assert requests.get(artist.picture(640,640)).status_code == 200
115128
assert requests.get(tidalapi.models.Artist.image.fget(artist, 640, 640)).status_code == 200
116129

130+
117131
def test_album_picture(session):
118132
album = session.get_album(17925106)
119133
assert requests.get(album.picture(640, 640)).status_code == 200
120134
assert requests.get(tidalapi.models.Album.image.fget(album, 640, 640)).status_code == 200
121135

136+
122137
def test_playlist_picture(session):
123138
playlist = session.get_playlist('33136f5a-d93a-4469-9353-8365897aaf94')
124139
assert requests.get(playlist.picture(750, 750)).status_code == 200
125140
assert requests.get(tidalapi.models.Playlist.image.fget(playlist, 750, 750)).status_code == 200
126141

142+
127143
def test_get_track_url(session):
128144
track = session.get_track(108043415)
129145
session.get_track_url(track.id)
130146

147+
131148
def test_get_video_url(session):
132149
video = session.get_video(108046194)
133150
session.get_video_url(video.id)
134151

152+
135153
def test_load_session(session):
136154
"""
137155
Test loading a session from a session id without supplying country code and user_id

tidalapi/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,21 @@ class Quality(Enum):
3939
high = 'HIGH'
4040
low = 'LOW'
4141

42+
4243
class VideoQuality(Enum):
4344
high = 'HIGH'
4445
medium = 'MEDIUM'
4546
low = 'LOW'
4647

48+
4749
class Config(object):
4850
def __init__(self, quality=Quality.high, video_quality=VideoQuality.high):
4951
self.quality = quality.value
5052
self.video_quality = video_quality.value
5153
self.api_location = 'https://api.tidalhifi.com/v1/'
5254
self.api_token = 'kgsOOmYk3zShYrNP'
5355

56+
5457
class Session(object):
5558
def __init__(self, config=Config()):
5659
self.session_id = None
@@ -321,6 +324,7 @@ def _parse_playlist(json_obj):
321324
}
322325
return Playlist(**kwargs)
323326

327+
324328
def _parse_media(json_obj):
325329
artist = _parse_artist(json_obj['artist'])
326330
artists = _parse_artists(json_obj['artists'])
@@ -347,6 +351,7 @@ def _parse_media(json_obj):
347351
return Video(**kwargs)
348352
return Track(**kwargs)
349353

354+
350355
def _parse_genres(json_obj):
351356
image = "http://resources.wimpmusic.com/images/%s/460x306.jpg" \
352357
% json_obj['image'].replace('-', '/')

0 commit comments

Comments
 (0)