skcriteria.testing module

Public testing utility functions.

This module exposes “assert” functions which facilitate the comparison in a testing environment of objects created in skcriteria.

The functionalities are extensions of those present in “pandas.testing” and “numpy.testing”.

skcriteria.testing.assert_dmatrix_equals(left, right, **diff_kws)[source]

Asserts that two DecisionMatrix objects are equal by comparing their attributes with some tolerance.

Parameters:
  • left (DecisionMatrix) – The first DecisionMatrix object to compare.

  • right (DecisionMatrix) – The second DecisionMatrix object to compare.

  • **diff_kws (dict) – Additional keyword arguments to pass to the DecisionMatrix.diff method.

Raises:

AssertionError – If the two DecisionMatrix objects are not equal.

skcriteria.testing.assert_result_equals(left, right, **diff_kws)[source]

Asserts that two results objects are equal by comparing their attributes with some tolerance.

Parameters:
  • left (skcriteria.agg.ResultABC) – The left result to compare.

  • right (skcriteria.agg.ResultABC) – The right result to compare.

  • **diff_kws (dict) – Optional keyword arguments to pass to the result diff method.

Raises:

AssertionError if the two results are not equal.

skcriteria.testing.assert_rcmp_equals(left, right, **diff_kws)[source]

Asserts that the left and right RankComparator objects are equal by comparing their attributes with some tolerance.

Parameters:
  • left (RanksComparator) – The left object to compare.

  • right (Any) – The right object to compare.

  • **diff_kws (keyword arguments) – Additional keyword arguments to pass to the diff method.

Raises:
  • AssertionError – If the left object is not an instance of RanksComparator.

  • AssertionError – If the right object is not an instance of RanksComparator.

  • AssertionError – If the left and right objects have different lengths.

  • AssertionError – If the ranks at any index of the left and right objects are not equal.