You can use `self.assertRaises` to do this.