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

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -