From 0bbf801e292b03418cb7632e4e22b08bdc54f293 Mon Sep 17 00:00:00 2001 From: melissaml Date: Wed, 14 Sep 2016 11:23:07 +0800 Subject: [PATCH] Modify use of assertTrue(A in B) Developers should use assertIn(A, B) instead of assertTrue(A in B). Because assertIn raise more meaningful errors: self.assertIn(3, [1, 2] >>> MismatchError: 3 not in [1, 2] self.assertTrue(3 in [1, 2]) >>> AssertionError: False is not true TrivialFix Change-Id: I09f0a348afba8b475b00913172a4dc0ce56f47ad --- tests/test_inventory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_inventory.py b/tests/test_inventory.py index a91c8fa6ef..cc0b1cdb3d 100644 --- a/tests/test_inventory.py +++ b/tests/test_inventory.py @@ -481,7 +481,7 @@ class TestConfigChecks(TestConfigCheckBase): with self.assertRaises(SystemExit) as context: get_inventory() expectedLog = "provider networks can't be found under global_overrides" - self.assertTrue(expectedLog in context.exception.message) + self.assertIn(expectedLog, context.exception.message) def test_global_overrides_check(self): # create config file without global_overrides