def test_movement_function_field_existence(self, fixture_raise_errors): """ Raises an exception when the input DataFrame does not have any of the columns: 'x', 'y', 'vx' and 'vy'. """ df = DataFrame(pytest.data_without_x) with pytest.raises(KeyError): AgentMovement.move_agents(df, pytest.box_size, pytest.dt)
def test_crash_with_boundary_wall_(self, fixture_crash_with_wall): """Crash of one agent with each of the four box boundary wall.""" df = DataFrame(pytest.data) df = AgentMovement.move_agents(df, pytest.box_size, pytest.dt) expected_df = DataFrame(pytest.expected_data) assert all(df == expected_df)
def test_movement_function_field_error(self, fixture_raise_errors): """Raises an exception when the input DataFrame has na values.""" df = DataFrame(pytest.data_na) with pytest.raises(ValueError, match=pytest.error_message): AgentMovement.move_agents(df, pytest.box_size, pytest.dt)
def test_movement_function(self, set_up): """Changes just the x agent position on the movement_function.""" df = DataFrame(pytest.data) df = AgentMovement.move_agents(df, pytest.box_size, pytest.dt) assert 1.0 == df['x'][0]