コード例 #1
0
def test_weather_creation():
    with HTTMock(location_mock):
        weather = Weather('fake key')

    assert isinstance(weather, Weather)
    assert weather.location == 'NYC, NY'
    assert weather.__str__() == 'NYC, NY'
    assert weather.__repr__() == '<Weather: NYC, NY>'
コード例 #2
0
def test_get_current():
    with HTTMock(location_mock):
        weather = Weather('fake_key')

    with HTTMock(current_mock):
        assert weather.get_current() == {"weather": "clear", "temp_f": "100"}