jeudi 10 août 2017

Find Type Of Exception

I have made a class (derived from Exception):

class InvalidFilterException(Exception):
      #some code here
      super().__init__(message)

Now, when I run tests on this module, using unittest.Testcase , running

assertRaises(Exception, InvalidFilterException, arg1, arg2)

Gives an Error:

AssertionError: Exception not raised by InvalidFilterException

Can someone tell me what should I put in place of Exception as the first argument in assertRaisesso that this test passes? I also tried using InvalidFilterException, as the argument, but that failed too, with the same output.

Aucun commentaire:

Enregistrer un commentaire