Esempio n. 1
0
def test_weather_maintains_manager_environment_up_to_date(manager):
    weather = Weather(constants.WEATHER_RAINY, 10)
    weather.register_to(manager)

    assert manager.environment['weather'] == constants.WEATHER_RAINY
    manager.update(10)
    assert manager.environment['weather'] == constants.WEATHER_SUNNY
Esempio n. 2
0
def test_weather_maintains_manager_environment_up_to_date(manager):
    weather = Weather(constants.WEATHER_RAINY, 10)
    weather.register_to(manager)

    assert manager.environment['weather'] == constants.WEATHER_RAINY
    manager.update(10)
    assert manager.environment['weather'] == constants.WEATHER_SUNNY
Esempio n. 3
0
def test_weather(manager):
    weather = Weather(constants.WEATHER_SUNNY, 10)
    weather.register_to(manager)

    assert weather.current_weather == constants.WEATHER_SUNNY
    manager.update(10)
    assert weather.current_weather == constants.WEATHER_RAINY
    manager.update(10)
    assert weather.current_weather == constants.WEATHER_SUNNY
Esempio n. 4
0
def test_weather(manager):
    weather = Weather(constants.WEATHER_SUNNY, 10)
    weather.register_to(manager)

    assert weather.current_weather == constants.WEATHER_SUNNY
    manager.update(10)
    assert weather.current_weather == constants.WEATHER_RAINY
    manager.update(10)
    assert weather.current_weather == constants.WEATHER_SUNNY
Esempio n. 5
0
def test_weather_does_not_update_if_cycle_is_incomplete(manager):
    weather = Weather(constants.WEATHER_SUNNY, 10)
    weather.register_to(manager)

    manager.update(5)
    assert weather.current_weather == constants.WEATHER_SUNNY
    manager.update(5)
    assert weather.current_weather == constants.WEATHER_RAINY
    manager.update(5)
    assert weather.current_weather == constants.WEATHER_RAINY
Esempio n. 6
0
def test_weather_does_not_update_if_cycle_is_incomplete(manager):
    weather = Weather(constants.WEATHER_SUNNY, 10)
    weather.register_to(manager)

    manager.update(5)
    assert weather.current_weather == constants.WEATHER_SUNNY
    manager.update(5)
    assert weather.current_weather == constants.WEATHER_RAINY
    manager.update(5)
    assert weather.current_weather == constants.WEATHER_RAINY
Esempio n. 7
0
def test_weather_is_aware_of_long_delta_gap(manager):
    weather = Weather(constants.WEATHER_SUNNY, 10)
    weather.register_to(manager)

    manager.update(20)
    assert weather.current_weather == constants.WEATHER_SUNNY
Esempio n. 8
0
def test_weather_is_aware_of_long_delta_gap(manager):
    weather = Weather(constants.WEATHER_SUNNY, 10)
    weather.register_to(manager)

    manager.update(20)
    assert weather.current_weather == constants.WEATHER_SUNNY