Use assertEqual/Greater/Less/IsNone
Instead of using assertFalse(A * B) / assertTrue(A * B), developers should use assertEqual/NotEqual/Less//Greater The * operator: '==', '<', '>' Change-Id: Ic4952ee034c8c8f6da70403cb767bb027058eeb0
This commit is contained in:
parent
4ab25b5a04
commit
053584c982
@ -98,7 +98,7 @@ class TestVersion(base.BaseApiTest):
|
||||
ver_2 = cbase.Version(
|
||||
{cbase.Version.string: '123.456'}, mock.ANY, mock.ANY)
|
||||
self.assertTrue(hasattr(ver_1, '__eq__'))
|
||||
self.assertTrue(ver_1 == ver_2)
|
||||
self.assertEqual(ver_1, ver_2)
|
||||
|
||||
def test_greaterthan(self):
|
||||
ver_1 = cbase.Version(
|
||||
@ -106,7 +106,7 @@ class TestVersion(base.BaseApiTest):
|
||||
ver_2 = cbase.Version(
|
||||
{cbase.Version.string: '123.456'}, mock.ANY, mock.ANY)
|
||||
self.assertTrue(hasattr(ver_1, '__gt__'))
|
||||
self.assertTrue(ver_1 > ver_2)
|
||||
self.assertGreater(ver_1, ver_2)
|
||||
|
||||
def test_lessthan(self):
|
||||
# __lt__ is created by @functools.total_ordering, make sure it exists
|
||||
@ -116,4 +116,4 @@ class TestVersion(base.BaseApiTest):
|
||||
ver_2 = cbase.Version(
|
||||
{cbase.Version.string: '123.457'}, mock.ANY, mock.ANY)
|
||||
self.assertTrue(hasattr(ver_1, '__lt__'))
|
||||
self.assertTrue(ver_1 < ver_2)
|
||||
self.assertLess(ver_1, ver_2)
|
||||
|
@ -167,7 +167,7 @@ class HashRingTestCase(base.TestCase):
|
||||
nodes, conductors, hash_ring.HashRing(conductors),
|
||||
new_conductors, hash_ring.HashRing(new_conductors))
|
||||
|
||||
self.assertTrue(len(delta) < num_nodes * redistribution_factor)
|
||||
self.assertLess(len(delta), num_nodes * redistribution_factor)
|
||||
|
||||
def test_rebalance_stability_leave(self):
|
||||
num_conductors = 10
|
||||
@ -185,7 +185,7 @@ class HashRingTestCase(base.TestCase):
|
||||
nodes, conductors, hash_ring.HashRing(conductors),
|
||||
new_conductors, hash_ring.HashRing(new_conductors))
|
||||
|
||||
self.assertTrue(len(delta) < num_nodes * redistribution_factor)
|
||||
self.assertLess(len(delta), num_nodes * redistribution_factor)
|
||||
|
||||
def test_more_replicas_than_hosts(self):
|
||||
hosts = ['foo', 'bar']
|
||||
|
@ -1912,7 +1912,7 @@ class DoNodeCleanTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
self.assertEqual(states.NOSTATE, node.target_provision_state)
|
||||
self.assertEqual({}, node.clean_step)
|
||||
self.assertFalse('clean_step_index' in node.driver_internal_info)
|
||||
self.assertEqual(None, node.driver_internal_info['clean_steps'])
|
||||
self.assertIsNone(node.driver_internal_info['clean_steps'])
|
||||
self.assertFalse(mock_execute.called)
|
||||
|
||||
def test__do_next_clean_step_automated_last_step_noop(self):
|
||||
@ -1952,7 +1952,7 @@ class DoNodeCleanTestCase(mgr_utils.ServiceSetUpMixin,
|
||||
self.assertEqual(states.NOSTATE, node.target_provision_state)
|
||||
self.assertEqual({}, node.clean_step)
|
||||
self.assertFalse('clean_step_index' in node.driver_internal_info)
|
||||
self.assertEqual(None, node.driver_internal_info['clean_steps'])
|
||||
self.assertIsNone(node.driver_internal_info['clean_steps'])
|
||||
mock_power_execute.assert_called_once_with(mock.ANY,
|
||||
self.clean_steps[1])
|
||||
mock_deploy_execute.assert_has_calls = [
|
||||
|
Loading…
Reference in New Issue
Block a user