From ec1e16f6be92d28f0b6c1757c55319132f16cc37 Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Wed, 2 Jan 2013 16:07:09 -0500 Subject: [PATCH] tests: Better asserts for better failure messages (imported from commit 18a485c6edf4c2d7d85098950b29c82c7f5ead42) --- zephyr/tests.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zephyr/tests.py b/zephyr/tests.py index 7b37492c97..32dd5f7b7d 100644 --- a/zephyr/tests.py +++ b/zephyr/tests.py @@ -86,7 +86,7 @@ class AuthedTestCase(TestCase): self.assertEquals(json.get("result"), "success") # We have a msg key for consistency with errors, but it typically has an # empty value. - self.assertTrue("msg" in json) + self.assertIn("msg", json) def assert_json_error(self, result, msg): """ @@ -435,8 +435,8 @@ class SubscriptionPropertiesTest(AuthedTestCase): subs = gather_subscriptions(self.get_user_profile(test_email)) for stream, color in json["stream_colors"]: - self.assertTrue(isinstance(color, str)) - self.assertTrue(isinstance(stream, str)) + self.assertIsInstance(color, str) + self.assertIsInstance(stream, str) self.assertIn((stream, color), subs) subs.remove((stream, color)) self.assertFalse(subs) @@ -514,7 +514,7 @@ class GetOldMessagesTest(AuthedTestCase): def check_well_formed_messages_response(self, result): self.assertIn("messages", result) - self.assertTrue(isinstance(result["messages"], list)) + self.assertIsInstance(result["messages"], list) for message in result["messages"]: for field in ("content", "content_type", "display_recipient", "gravatar_hash", "recipient_id", "sender_full_name",