compare, computed, label: str = None, *, quiet: bool = False, return_message: bool = False, return_handler: Callable = None) → bool[source]

Returns True if two integers, strings, booleans, or integer arrays are element-wise equal.

  • expected (int, bool, str or int array-like) – Reference value against which computed is compared.

  • computed (int, bool, str or int array-like) – Input value to compare against expected.

  • label (str, optional) – Label for passed and error messages. Defaults to calling function name.


  • allclose (bool) – Returns True if expected and computed are equal; False otherwise.

  • message (str, optional) – When return_message=True, also return passed or error message.

Other Parameters

return_handler (function, optional) – Function to control printing, logging, raising, and returning. Specialized interception for interfacing testing systems.


  • Akin to np.array_equal.

  • For scalar exactly-comparable types and for arbitrary-dimension, np.ndarray-castable, uniform-type, exactly-comparable types. For mixed types, use compare_recursive().