Using self.assertRaisesRegexp would be a bit less verbose here, and both assertRaises-as-ContextManager and assertRaisesRegexp are new in python 2.7.