unit testing - Python unittest - opposite of assertRaises? -
i want write test establish exception not raised in given circumstance.
it's straightforward test if exception is raised ...
sinvalidpath=alwayssuppliesaninvalidpath() self.assertraises(pathisnotavalidone, myobject, sinvalidpath)
... how can opposite.
something i'm after ...
svalidpath=alwayssuppliesavalidpath() self.assertnotraises(pathisnotavalidone, myobject, svalidpath)
try: myfunc() except exceptiontype: self.fail("myfunc() raised exceptiontype unexpectedly!")
Comments
Post a Comment