testing module¶
Testing tools.
- gemseo.utils.testing.compare_dict_of_arrays(dict_of_arrays, other_dict_of_arrays, tolerance=0.0)[source]¶
Check if two dictionaries of NumPy arrays are equal.
These dictionaries can be nested.
- Parameters:
dict_of_arrays (Mapping[str, ndarray] | Mapping[str, Mapping[str, ndarray]]) – A dictionary of NumPy arrays.
other_dict_of_arrays (Mapping[str, ndarray] | Mapping[str, Mapping[str, ndarray]]) – Another dictionary of NumPy arrays.
tolerance (float) –
A relative tolerance. The dictionaries are approximately equal if for any key
reference_name
ofreference_dict_of_arrays
,norm(dict_of_arrays[name]-reference_dict_of_arrays[name]) /(1+norm(reference_dict_of_arrays))<= cache_tol
By default it is set to 0.0.
- Returns:
Whether the dictionaries are equal.
- Return type: