def test_add_str_artsts(): graph = MusicalGraph("./data/test/test.pickle") worker = Worker(graph) try: worker.add_artists("Logic") except AssertionError: pass
def test_search_process(): graph = MusicalGraph("./data/test/test.pickle") worker = Worker(graph) response = worker._search_for_artist("Logic") processed = worker._get_artist_meta(response) print(processed) assert len(processed) == 3 assert 'id' in processed.keys()
def test_add_genre(): graph = MusicalGraph("./data/test/test.pickle") worker = Worker(graph) worker.add_artists(["Logic"]) assert len(graph.G.nodes) > 1
def test_search(): graph = MusicalGraph("./data/test/test.pickle") worker = Worker(graph) response = worker._search_for_artist("Logic") assert response['name'] == "Logic"
def test_add_list_artsts(): graph = MusicalGraph("./data/test/test.pickle") worker = Worker(graph) worker.add_artists(["Logic"]) assert "Logic" in graph.G.nodes
def test_credential(): graph = MusicalGraph("./data/test/test.pickle") worker = Worker(graph) worker._generate_token()
import sys sys.path.append(".") import pandas as pd from MusicalGraph.MusicalGraph import MusicalGraph from MusicalGraph.Worker import Worker history_path = "./data/s3/history.csv" graph_path = "./data/s4/graph.pickle" graph = MusicalGraph(graph_path) worker = Worker(graph) history = pd.read_csv(history_path) artists = list(history.artist.unique()) worker.add_artists(artists)