test#


snapshot_compatible(obj, float_decimals=6, significant_digits=12)[source]#

Renders an object snapshot-compatible by appropriately converting nested types and reducing float precision to a level that is likely to not cause problems when testing snapshots for equivalence on different platforms

Parameters:
  • obj – the object to convert

  • float_decimals – the number of float decimal places to consider

  • significant_digits – the (maximum) number of significant digits to consider

Returns:

the converted object

reduce_float_precision(f, decimals, significant_digits)[source]#
convert_floats(o, float_decimals, significant_digits)[source]#
json_mapper(o)[source]#

Maps the given data object to a representation that is JSON-compatible. Currently, the supported object types include, in particular, numpy arrays as well as pandas Series and DataFrames.

Parameters:

o – the object to convert

Returns:

the converted object