def test_failure(self): testee = TornadoClient(self.get_url('/fail')) with self.assertRaises(httpclient.HTTPError) as ctx: yield testee.fail(code=500) self.assertEqual('HTTP 500: Internal Server Error', str(ctx.exception))