Use `self.assertRaises` instead of the try/except block