arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

concrete.ml.common.debugging.custom_assert.md

arrow-up-right

hashtag
module concrete.ml.common.debugging.custom_assert

Provide some variants of assert.


hashtag
function assert_true

Provide a custom assert to check that the condition is True.

Args:

  • condition (bool): the condition. If False, raise AssertionError

  • on_error_msg (str): optional message for precising the error, in case of error

  • error_type


hashtag
function assert_false

Provide a custom assert to check that the condition is False.

Args:

  • condition (bool): the condition. If True, raise AssertionError

  • on_error_msg (str): optional message for precising the error, in case of error

  • error_type


hashtag
function assert_not_reached

Provide a custom assert to check that a piece of code is never reached.

Args:

  • on_error_msg (str): message for precising the error

  • error_type (Type[Exception]): the type of error to raise, if condition is not fulfilled. Default to AssertionError

(Type[Exception]): the type of error to raise, if condition is not fulfilled. Default to AssertionError
(Type[Exception]): the type of error to raise, if condition is not fulfilled. Default to AssertionError
arrow-up-right
arrow-up-right
arrow-up-right
assert_true(
    condition: bool,
    on_error_msg: str = '',
    error_type: Type[Exception] = <class 'AssertionError'>
)
assert_false(
    condition: bool,
    on_error_msg: str = '',
    error_type: Type[Exception] = <class 'AssertionError'>
)
assert_not_reached(
    on_error_msg: str,
    error_type: Type[Exception] = <class 'AssertionError'>
)