mirror of
https://github.com/c0de-archive/spotipy.git
synced 2025-07-30 14:00:18 +00:00
Cleaning up some tests
This commit is contained in:
@@ -5,6 +5,7 @@ from spotipy import util
|
||||
import unittest
|
||||
import pprint
|
||||
import sys
|
||||
import simplejson as json
|
||||
|
||||
'''
|
||||
Since these tests require authentication they are maintained
|
||||
@@ -173,25 +174,6 @@ class AuthTestSpotipy(unittest.TestCase):
|
||||
self.assertTrue(playlist['tracks']['total'] == 3)
|
||||
self.assertTrue(len(playlist['tracks']['items']) == 3)
|
||||
|
||||
def test_audio_features(self):
|
||||
results = spotify.audio_features(self.four_tracks)
|
||||
self.assertTrue(len(results) == len(self.four_tracks))
|
||||
for attr in results:
|
||||
assert('speechiness' in attr)
|
||||
|
||||
def test_audio_features_with_bad_track(self):
|
||||
bad_tracks = ['spotify:track:bad']
|
||||
input = self.four_tracks + bad_tracks
|
||||
results = spotify.audio_features(input)
|
||||
self.assertTrue(len(results) == len(input))
|
||||
none_count = 0
|
||||
for attr in results:
|
||||
if attr == None:
|
||||
none_count +=1
|
||||
else:
|
||||
assert('speechiness' in attr)
|
||||
self.assertTrue(none_count == len(bad_tracks))
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) > 1:
|
||||
username = sys.argv[1]
|
||||
|
@@ -38,7 +38,6 @@ class AuthTestSpotipy(unittest.TestCase):
|
||||
|
||||
|
||||
def test_audio_features(self):
|
||||
print "test audio features"
|
||||
results = spotify.audio_features(self.four_tracks)
|
||||
self.assertTrue(len(results) == len(self.four_tracks))
|
||||
for track in results:
|
||||
@@ -49,7 +48,6 @@ class AuthTestSpotipy(unittest.TestCase):
|
||||
bad_tracks = ['spotify:track:bad']
|
||||
input = bad_tracks + self.four_tracks + bad_tracks
|
||||
results = spotify.audio_features(input)
|
||||
print(json.dumps(results, indent=4))
|
||||
self.assertTrue(len(results) == len(input))
|
||||
for track in results[:-1]:
|
||||
assert('speechiness' in track)
|
||||
|
Reference in New Issue
Block a user