gemseo / utils

testing module

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, numpy.ndarray]) – A dictionary of NumPy arrays.

  • other_dict_of_arrays (Mapping[str, numpy.ndarray]) – Another dictionary of NumPy arrays.

  • tolerance (float) –

    A relative tolerance. The dictionaries are approximately equal if for any key reference_name of reference_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

bool

gemseo.utils.testing.image_comparison(*args, **kwargs)[source]

Compare matplotlib images generated by the tests with reference ones.

This overloads matplotlib.testing.decorators.image_comparison() by using "default" as style if missing. Use ["png"] as extensions if missing.

Parameters
  • *args (Any) –

  • **kwargs (Any) –

Return type

None