Ejemplo 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
Ejemplo 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
Ejemplo 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
Ejemplo 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
Ejemplo 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
Ejemplo 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
Ejemplo n.º 7
0
    def __init__(self):
        self.is_running = True
        self.manager = Manager()

        Attack(frequence=4, max_to_kill=2).register_to(self.manager)
        MoodSwings().register_to(self.manager)
        Reproduction().register_to(self.manager)
        Time().register_to(self.manager)
        Weather(constants.WEATHER_SUNNY, 10).register_to(self.manager)

        self.api_server_thread = api_handler.setup(self.manager)
Ejemplo 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
Ejemplo n.º 9
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