Ejemplo n.º 1
0
def test_hurricane(m):
    fullurl = 'http://api.wunderground.com/api/{}/currenthurricane/view.json'.format(my_secret_key)

    with open('weather_data/hurricane.json') as data:
        m.get(fullurl, text=data.read())

    hurricane = Hurricane()
    res = hurricane.run()

    assert res[0] == 'Hurricane Olaf'
def weather_report(zipcode):
    while True:
        x = input('''\n
Enter 1 for current weather conditions.
Enter 2 for the ten-day forecast.
Enter 3 for sunrise and sunset times.
Enter 4 for weather alerts.
Enter 5 for a list of named tropical storms.
Enter exit to exit.\n:''')
        if x == '1':
            print(Current(zipcode).run())
        elif x == '2':
            print(TenDay(zipcode).run())
        elif x == '3':
            print(Astronomy(zipcode).run())
        elif x == '4':
            print(Alerts(zipcode).run())
        elif x == '5':
            print(Hurricane.run())
        else:
            exit()