General Framework Tests

Aggregator Tests

test_example_aggregator_has_known_shape

Creating simple aggregator input

test_save

test_collision_of_calculations_raises_by_example

test_load

test_compute_of_a_graph_vs_known_implementation

Tests data transfer through the Aggregator

test_composition_of_specific_agrs_yields_known_agr

test_aggregator_input_works_as_expected

test_ida_root_functions

test_agr_input_connect

test_ida_continuous_mode

test_associated_calculations_for_a_known_example

mock_agr()[source]
test_add_variables_accepts_added_variables_correctly()[source]
Return type:

None

test_add_variables_creates_new_edge_if_referenced_edge_doesnt_exist()[source]
test_add_variables_is_idempotent()[source]
Return type:

None

test_aggregator_input_works_as_expected()[source]
test_agr_identifies_missing_variables_in_indices_for_known_examples(graph, expectation)[source]
test_agr_input_connect()[source]
test_associated_calculations_for_a_known_example(mock_agr)[source]
test_collision_of_calculations_raises_by_example()[source]
Return type:

None

test_composition_of_specific_agrs_yields_known_agr()[source]
test_compute_of_a_graph_vs_known_implementation(mock_agr)[source]

Tests data transfer through the Aggregator

Return type:

None

test_create_constraints_for_a_known_example()[source]
test_create_constraints_with_bad_name_errors_well()[source]
test_example_aggregator_has_known_shape(mock_agr)[source]

Creating simple aggregator input

test_ida_continuous_mode()[source]
test_ida_root_functions()[source]
test_load(mock_agr)[source]
Return type:

None

test_load_reverses_save_by_example(mock_agr)[source]
test_save(mock_agr)[source]
Return type:

None

Data Representation Tests

test_dataframe_of_vertical_vector_has_multiple_i_single_j

Tests that a dataframe with vertical vectors has multiple values of i and only 1 value of j.

test_state_of_vertical_vector_is_vertical

Tests that a vertically created dataframe is read as vertical vectors.

test_state_to_dataframe_and_back_is_same

Tests that going to dataframe and back is unity.

test_statetimeseries_to_dataframe_and_back_is_same

Tests that state_timeseries_from_dataframe is the inverse of state_timeseries_to_dataframe

test_solution_to_statetimeseries_and_back_is_same_by_example

Tests that solution_from_states is the inverse of solution_from_states.

Tests for states and dataframes.

mock_agr()[source]

Simple aggregator example

test_dataframe_of_vertical_vector_has_multiple_i_single_j()[source]

Tests that a dataframe with vertical vectors has multiple values of i and only 1 value of j.

Return type:

None

test_solution_to_statetimeseries_and_back_is_same_by_example(mock_agr)[source]

Tests that solution_from_states is the inverse of solution_from_states.

Return type:

None

test_state_of_vertical_vector_is_vertical()[source]

Tests that a vertically created dataframe is read as vertical vectors.

Return type:

None

test_state_to_dataframe_and_back_is_same()[source]

Tests that going to dataframe and back is unity.

Return type:

None

test_statetimeseries_to_dataframe_and_back_is_same()[source]

Tests that state_timeseries_from_dataframe is the inverse of state_timeseries_to_dataframe

Return type:

None

Calculation (Framework) Tests

test_unpack_correctly_unpacks_data

test_concat_is_at_most_1d

test_concat_of_dictionaried_arrays_is_the_same_as_their_numpy_concat

test_default_save_has_correct_output_for_one_structure

test_default_save_is_compatible_with_calc_variables

test_default_load_for_one_structure

test_default_load_is_inverse_of_default_save

test_concat_is_at_most_1d()[source]
Return type:

None

test_concat_of_dictionaried_arrays_is_the_same_as_their_numpy_concat()[source]
Return type:

None

test_default_load_for_one_structure()[source]
Return type:

None

test_default_load_is_inverse_of_default_save()[source]
Return type:

None

test_default_save_has_correct_output_for_one_structure()[source]
Return type:

None

test_default_save_is_compatible_with_calc_variables()[source]
Return type:

None

test_unpack_correctly_excludes_parameters()[source]
Return type:

None

test_unpack_correctly_unpacks_data()[source]
Return type:

None

test_unpack_exclusion_errors_on_missing_variable_name()[source]

Solver Backend Tests

test_dae_solver_using_planar_pendulum_against_scikits_odes_documented_solution

This is an example given by the Scikits.Odes developers for a simple usage case: A planar pendulum.

test_dae_with_undetermined_var_fails_as_TransientRuntimeError

This test constructs a calculation in which one variable is free, meaning its algebraic equation returns 0 for any input.

test_dae_solver_accepts_all_algebraic_calculations

Testing the possibility of working with an all algebraic set of equations in scikits.odes.

test_dae_solver_accepts_all_algebraic_calculations()[source]

Testing the possibility of working with an all algebraic set of equations in scikits.odes.

test_dae_solver_using_planar_pendulum_against_scikits_odes_documented_solution()[source]

This is an example given by the Scikits.Odes developers for a simple usage case: A planar pendulum. For further explanation please refer to their documentation.

test_dae_with_undetermined_var_fails_as_TransientRuntimeError()[source]

This test constructs a calculation in which one variable is free, meaning its algebraic equation returns 0 for any input. It is also disconnected from the rest of the equations.

Such a calculation is expected to fail.

Utilities Tests

test_pair_mean_for_one_simple_case

test_just

test_offset

test_offset_of_an_unknown_type_raises_TypeError

test_cosine_shape_with_ppf_1_is_uniform

test_cosine_shape_achieves_maximum_at_center

test_cosine_extrapolation_endpoints_are_zero_for_high_resolution()[source]

This test ensures that the underlying cosine function nullifies at its extrapolation points.

The test needs high resolution because the return value is cell-integrated, so it never truly nullifies in a cell, unless a cell goes beyond the extrapolation points.

Return type:

None

test_cosine_extrapolation_has_maximum_at_midpoint()[source]
Return type:

None

test_cosine_extrapolation_has_sum_1_over_inner_region()[source]
Return type:

None

test_cosine_shape_achieves_maximum_at_center()[source]
Return type:

None

test_cosine_shape_max_is_like_ppf_for_high_resolution()[source]

This test ensures that the underlying cosine shape’s max to mean ratio meets the desired PPF value.

Since the function returns cell-integrated values, in order to approximate the ppf value we need a high enough resolution.

Return type:

None

test_cosine_shape_sums_to_1()[source]
Return type:

None

test_cosine_shape_throws_for_illegal_ppf()[source]
Return type:

None

test_cosine_shape_with_ppf_1_is_uniform()[source]
test_just()[source]
test_offset()[source]
Return type:

None

test_offset_of_an_unknown_type_raises_TypeError()[source]
test_pair_mean_1d_is_pair_mean()[source]
Return type:

None

test_pair_mean_for_one_simple_case()[source]
test_uniform_x_power_shape_works_with_clad_N_equals_zero()[source]
Return type:

None