Python unittest - opposite of assertRaises?

前端 未结 10 692
甜味超标
甜味超标 2020-12-04 05:36

I want to write a test to establish that an Exception is not raised in a given circumstance.

It\'s straightforward to test if an Exception is raise

10条回答
  •  广开言路
    2020-12-04 05:49

    Hi - I want to write a test to establish that an Exception is not raised in a given circumstance.

    That's the default assumption -- exceptions are not raised.

    If you say nothing else, that's assumed in every single test.

    You don't have to actually write an any assertion for that.

提交回复
热议问题