Assert exception during python unit test

If using unittest:

import unittest

with self.assertRaises( Exception ) as error:
   ...

If using pytest:

import pytest

with pytest.raises( Exception ) as error:
   ...

Leave a Reply

Your email address will not be published. Required fields are marked *