Пример #1
0
 def test_artist_with_multiple_albums(self):
     artist = Artist('artist name', 'country')
     artist.add_album(Album('first album title', 2020))
     artist.add_album(Album('second album title', 2020))
     expected_albums = [
         Album('first album title', 2020),
         Album('second album title', 2020)
     ]
     assert list(artist.get_albums()) == expected_albums
Пример #2
0
 def test_sort_albums_by_most_recent(self):
     artist = Artist('artist name', 'country')
     artist.add_album(Album('first album title', 2020))
     artist.add_album(Album('second album title', 2021))
     expected_albums = [
         Album('second album title', 2021),
         Album('first album title', 2020)
     ]
     artist.sort_albums_by_date()
     assert list(artist.get_albums()) == expected_albums
Пример #3
0
 def test_artist_without_albums(self):
     artist = Artist('artist name', 'country')
     assert list(artist.get_albums()) == []
Пример #4
0
 def test_artist_with_single_album(self):
     artist = Artist('artist name', 'country')
     artist.add_album(Album('album title', 2020))
     assert list(artist.get_albums()) == [Album('album title', 2020)]
                "Select the correct rap genius url for the artist: ")

        if int(choice_input) == new_search_choice:
            continue
        artist_url = None
        for i in range(int(choice_input)):
            artist_url = artist_urls.pop()
        if artist_url is not None:
            artist_name = str.partition(artist_url, "/artists/")[2]
            rap_genius_artist = Artist(artist_name, artist_url)

            create_word_clouds_for_artist(rap_genius_artist)
            # print out choices and ask user to select which word cloud to present
            print("A: " + rap_genius_artist.get_artist_name() + " Word Cloud")
            choice = 1
            for album in rap_genius_artist.get_albums():
                print(
                    str(choice) + ": Album \"" + album.get_album_name() +
                    "\" word cloud")
                choice = choice + 1

            new_artist_choice = choice
            print(str(choice) + ": Search for new artist")
            end_choice = choice + 1
            print(str(end_choice) + ": End program")
            next_choice = None
            choice_number = 0

            while True:
                next_choice = input("Select a Word Cloud to display: ")
                while next_choice != 'A' and (not str.isdigit(next_choice) or