how to writing unit tests for exception and raise? For example I have
someFoo.py
class MyExc(Exception):
"""
my exc
"""
pass
def foo(a,b,c):
raise MyExc
def foo1(a,b):
assert a==b, 'a==b!!'
tests.py
from someFoo import foo,foo1
import unittest
class Test(unittest.TestCase):
pass
and I can't find good solution for this
raise a==b, 'a==b!!'will give you the errorTypeError: exceptions must derive from BaseException, so you probably don't want to do that. You can't use any object withraise; it has to be an exception object.assert