pwtools.common.assert_cond

pwtools.common.assert_cond(cond, string=None)[source]

Use this instead of assert cond, string. It’s been said on numpy-discussions that the assert statement shouldn’t be used to test user input in functions b/c with python … -O0 or __debug__ not beeing defined, the statement is not tested.

Parameters:
  • cond (bool) – True : None is returned False : exception is raised

  • string (str)

Examples

assert_cond(1==1, ‘lala’) -> ok assert_cond(1==2, ‘lala’) -> exception is raised