ballet.util.testing module

ballet.util.testing.assert_array_almost_equal(first, second, places=6, delta=None)[source]

Test that arrays first and second are almost equal

There are two ways to control the tolerance of the approximate equality test, using places or delta. All values are compared element-wise. delta is provided, the allowed tolerance between the values is set to delta. Else if ``places is provided, values are compared up to places places. Else, places defaults to 6.

Parameters
  • first – first object

  • second – second object

  • places (int, default=6) – elements are compared up to this many places

  • delta (float) – the allowed tolerance between elements

ballet.util.testing.assert_array_equal(first, second)[source]
ballet.util.testing.assert_array_not_almost_equal(first, second, places=6, delta=None)[source]

Test that arrays first and second are not almost equal

ballet.util.testing.assert_array_not_equal(first, second)[source]
ballet.util.testing.assert_frame_equal(first, second, **kwargs)[source]

Test that DataFrames first and second are equal

ballet.util.testing.assert_frame_not_equal(first, second, **kwargs)[source]

Test that DataFrames first and second are not equal

ballet.util.testing.assert_index_equal(first, second, **kwargs)[source]

Test that Index first and second are equal

ballet.util.testing.assert_index_not_equal(first, second, **kwargs)[source]

Test that Index first and second are not equal

ballet.util.testing.assert_pandas_object_equal(first, second, **kwargs)[source]

Test that arbitrary Pandas objects first and second are equal

ballet.util.testing.assert_pandas_object_not_equal(first, second, **kwargs)[source]

Test that arbitrary Pandas objects first and second are not equal

ballet.util.testing.assert_series_equal(first, second, **kwargs)[source]

Test that Series first and second are equal

ballet.util.testing.assert_series_not_equal(first, second, **kwargs)[source]

Test that Series first and second are not equal

ballet.util.testing.log_seed_on_error(logger, seed=None)[source]

Store seed, run code, and report seed if error

ballet.util.testing.seeded(seed)[source]

Set seed, run code, then restore rng state