You should check out `self.assertRaises`, which will let you clean this up.