def test_integrator_function_with_params_of_different_lengths(): with pytest.raises(FunctionError) as error_text: Functions.AdaptiveIntegrator(rate=[.1, .2, .3], offset=[.4, .5]) error_msg_a = "The parameters with len>1 specified for AdaptiveIntegrator Function" error_msg_b = "(['rate', 'offset']) don't all have the same length" assert error_msg_a in str(error_text.value) assert error_msg_b in str(error_text.value)
def test_integrator_function_default_variable_len_1_but_user_specified_and_params_len_more_than_1( ): with pytest.raises(FunctionError) as error_text: Functions.AdaptiveIntegrator(default_variable=[1], rate=[.1, .2, .3]) error_msg_a = 'The length of the array specified for the rate parameter' error_msg_b = 'must match the length of the default input' assert error_msg_a in str(error_text.value) assert error_msg_b in str(error_text.value)
def test_integrator_function_with_default_variable_and_params_of_different_lengths( ): with pytest.raises(FunctionError) as error_text: Functions.AdaptiveIntegrator(default_variable=[0, 0, 0], rate=[.1, .2, .3], offset=[.4, .5]) error_msg_a = "The following parameters with len>1 specified for AdaptiveIntegrator Function" error_msg_b = "don't have the same length as its 'default_variable' (3): ['offset']." assert error_msg_a in str(error_text.value) assert error_msg_b in str(error_text.value)
def test_integrator_function_no_default_variable_and_params_len_more_than_1(): I = Functions.AdaptiveIntegrator(rate=[.1, .2, .3]) I.defaults.variable = np.array([0, 0, 0])