Pytest expected exception


  • What if raising an exception is part of the specification of a function?
  • That given certain (incorrect) input it will raise a certain exception?
  • How can we test that we get the right exception. The expected exception?