Use assertGreater(len(x), 0) instead of assertTrue(len(x) > 0)

assertGreater provides a nicer error message if it fails.

Change-Id: Id9a2e11e21cca87bb4ef23ced5bbbae6817dba73
This commit is contained in:
Cao Xuan Hoang 2016-12-09 09:46:19 +07:00
parent f54339f316
commit f8851fbdd6
3 changed files with 4 additions and 4 deletions

View File

@ -1098,8 +1098,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
matching = list(moves.filter(lambda r: _matches_row_id(r),
res.context))
self.assertTrue(len(matching) > 1,
"Expected at least one row matching %s" % row_id)
self.assertGreater(len(matching), 1,
"Expected at least one row matching %s" % row_id)
row = matching[-1].dicts[1]
matching_actions = list(moves.filter(lambda a: a.name == action_name,
row['row_actions']))

View File

@ -38,7 +38,7 @@ class TestDefaults(helpers.AdminTestCase):
self.assertFalse(
self.defaults_page.find_message_and_dismiss(messages.ERROR))
self.assertTrue(len(default_quota_values) > 0)
self.assertGreater(len(default_quota_values), 0)
for quota_name in default_quota_values:
self.assertTrue(

View File

@ -20,4 +20,4 @@ class BrowserTests(test.SeleniumTestCase):
self.selenium.get(self.live_server_url)
button = self.selenium.find_element_by_id("loginBtn")
# Ensure button has something; must be language independent.
self.assertTrue(len(button.text) > 0)
self.assertGreater(len(button.text), 0)