def test_get_audio_feature_representative_range__single_track__allows_full_range( self): audio_features = mock_audio_features(danceability=0.75) playlist = mock_playlist( tracks=[mock_track(audio_features=audio_features)]) audio_feature_range = self.playlist_stats.get_audio_feature_representative_range( playlist) self.assertEqual(0, audio_feature_range[0].danceability) self.assertEqual(1, audio_feature_range[1].danceability)
def test_get_audio_feature_representative_range__tracks_with_same_value( self): audio_features_1 = mock_audio_features(danceability=0.75) audio_features_2 = mock_audio_features(danceability=0.75) playlist = mock_playlist(tracks=[ mock_track(audio_features=audio_features_1), mock_track(audio_features=audio_features_2), ]) audio_feature_range = self.playlist_stats.get_audio_feature_representative_range( playlist) self.assertEqual(0.75, audio_feature_range[0].danceability) self.assertEqual(0.75, audio_feature_range[1].danceability)
def test_get_audio_feature_representative_range__multiple_tracks__matches_range( self): audio_features_1 = mock_audio_features(danceability=0.95) audio_features_2 = mock_audio_features(danceability=0.05) playlist = mock_playlist(tracks=[ mock_track(audio_features=audio_features_1), mock_track(audio_features=audio_features_2), ]) audio_feature_range = self.playlist_stats.get_audio_feature_representative_range( playlist) self.assertLessEqual(0, audio_feature_range[0].danceability) self.assertGreaterEqual(1, audio_feature_range[1].danceability)