gluonts.testutil.equality module#

gluonts.testutil.equality.assert_recursively_close(obj_a, obj_b, rtol=1e-05, atol=1e-08, equal_nan=True)[source]#

Asserts that two objects are “close” to each other, recursively.

Strings or ints are close iff they are equal; floats or numpy arrays are defined close according to the numpy.isclose and numpy.allclose functions, respectively. Lists are close if all of their items are close. Dicts are close if they have the same keys, and elements corresponding to the same key are close.

obj_a obj_b

Objects to compare.

rtol atol

Relative and absolute tolerance for float comparison; see docs for numpy.isclose.

equal_nan

Indicates whether or not numpy.nan values should be considered equal.

gluonts.testutil.equality.assert_recursively_equal(obj_a, obj_b, equal_nan=True)[source]#

Asserts that two objects are equal, recursively.

This is based on assert_recursively_close(), and accepts the same arguments, except that tolerances are set to zero.

obj_a obj_b

Objects to compare.

equal_nan

Indicates whether or not numpy.nan values should be considered equal.