vendredi 26 décembre 2014

how can I use assertRaises() in python's unittest to catch syntaxerror?

for example, I want to test a function which has a syntax, in my unittest class's method, can I use code as self.assertRaises(SyntaxError, my_function) ?


when I use this, it just appears traceback of syntax error rather than showing how many tests have passed.


Aucun commentaire:

Enregistrer un commentaire