示例#1
0
def search():
    """
    #gets variables for the UI of the search queries

    """
    artist_name = ui.get_string('What is the name of the artist you are searching for?: ')
    album_title = ui.get_string('What is the name of the album you are looking for?: ')
    song_title = ui.get_string('What is the name of the song you are looking for?: ')
    follower_count = search_spotify(artist_name)
    lyrics = search_lyrics(artist_name, song_title)
    artwork = search_artwork(artist_name, album_title)

    results = {
        'artist_name': artist_name,
        'album_title': album_title,
        'song_title': song_title,
        'artwork': artwork,
        'lyrics': lyrics,
        'follower_count': follower_count
    }
    print_search_results(results)
    save = ui.save_bookmark()

    if save == True:
        save_new_bookmark(results)
    else:
        print('Okay this bookmark will not be saved')
示例#2
0
def delete_tree():
    name = ui.get_string('Enter name of tree')
    deleted = database.delete_tree_by_name(name)
    if deleted:
        print('Tree was deleted')
    else:
        print('That tree was not in the database')
示例#3
0
def add_tree():
    name = ui.get_string('Enter name of tree')
    max_height = ui.get_positive_float(f'Enter max height of {name}')
    try:
        database.add_tree(name, max_height)
        print('Added tree')
    except TreeError as e:
        print(e)
示例#4
0
def get_name_and_email():
    name = ui.get_string('Enter artist name: ')
    email = ui.get_string('Enter artist email: ')
    return name, email
示例#5
0
 def test_get_string_rejects_empty_inputs(self, mock_input):
     question = "Please enter a name:"
     self.assertEqual('some name', ui.get_string(question))
示例#6
0
文件: artwork.py 项目: yp0975eu/p3
def get_artwork_name():
    return ui.get_string('Enter artwork name: ')
示例#7
0
文件: artwork.py 项目: yp0975eu/p3
def get_artwork_price():
    return ui.get_string('Enter price: ')
示例#8
0
 def test_get_string(self, mock):
     message = 'message'
     response = ui.get_string(message)
     self.assertTrue(response, 'fake_response')