Commit 5cb770e5 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Replace failUnless() with assertTrue()

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1492 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent af374f83
...@@ -117,7 +117,7 @@ class ZODBTests(NEOFunctionalTest): ...@@ -117,7 +117,7 @@ class ZODBTests(NEOFunctionalTest):
else: else:
raise raise
else: else:
self.failUnless(not abort_it, 'Did not abort duplication') self.assertTrue(not abort_it, 'Did not abort duplication')
l1 = list(ob.items()) l1 = list(ob.items())
l1.sort() l1.sort()
l2 = list(ob2.items()) l2 = list(ob2.items())
......
...@@ -76,7 +76,7 @@ class MasterClientHandlerTests(NeoTestBase): ...@@ -76,7 +76,7 @@ class MasterClientHandlerTests(NeoTestBase):
client_uuid = self.identifyToMasterNode(node_type=NodeTypes.CLIENT, port=self.client_port) client_uuid = self.identifyToMasterNode(node_type=NodeTypes.CLIENT, port=self.client_port)
conn = self.getFakeConnection(client_uuid, self.client_address) conn = self.getFakeConnection(client_uuid, self.client_address)
service.askBeginTransaction(conn, packet, None) service.askBeginTransaction(conn, packet, None)
self.failUnless(ltid < self.app.tm.getLastTID()) self.assertTrue(ltid < self.app.tm.getLastTID())
self.assertEqual(len(self.app.tm.getPendingList()), 1) self.assertEqual(len(self.app.tm.getPendingList()), 1)
tid = self.app.tm.getPendingList()[0] tid = self.app.tm.getPendingList()[0]
self.assertEquals(tid, self.app.tm.getLastTID()) self.assertEquals(tid, self.app.tm.getLastTID())
...@@ -91,7 +91,7 @@ class MasterClientHandlerTests(NeoTestBase): ...@@ -91,7 +91,7 @@ class MasterClientHandlerTests(NeoTestBase):
client_uuid = self.identifyToMasterNode(node_type=NodeTypes.CLIENT, port=self.client_port) client_uuid = self.identifyToMasterNode(node_type=NodeTypes.CLIENT, port=self.client_port)
conn = self.getFakeConnection(client_uuid, self.client_address) conn = self.getFakeConnection(client_uuid, self.client_address)
service.askNewOIDs(conn, packet, 1) service.askNewOIDs(conn, packet, 1)
self.failUnless(loid < self.app.loid) self.assertTrue(loid < self.app.loid)
def test_09_finishTransaction(self): def test_09_finishTransaction(self):
service = self.service service = self.service
......
...@@ -47,7 +47,7 @@ class MasterPartitionTableTests(NeoTestBase): ...@@ -47,7 +47,7 @@ class MasterPartitionTableTests(NeoTestBase):
self.assertEqual(len(partition_list), num_partitions) self.assertEqual(len(partition_list), num_partitions)
for x in xrange(num_partitions): for x in xrange(num_partitions):
part = partition_list[x] part = partition_list[x]
self.failUnless(isinstance(part, list)) self.assertTrue(isinstance(part, list))
self.assertEqual(len(part), 0) self.assertEqual(len(part), 0)
self.assertEqual(len(pt.count_dict), 0) self.assertEqual(len(pt.count_dict), 0)
# no nodes or cells for now # no nodes or cells for now
...@@ -125,8 +125,8 @@ class MasterPartitionTableTests(NeoTestBase): ...@@ -125,8 +125,8 @@ class MasterPartitionTableTests(NeoTestBase):
cells_outdated = pt.outdate() cells_outdated = pt.outdate()
self.assertEqual(len(cells_outdated), 3) self.assertEqual(len(cells_outdated), 3)
for offset, uuid, state in cells_outdated: for offset, uuid, state in cells_outdated:
self.failUnless(offset in (1,2,3)) self.assertTrue(offset in (1,2,3))
self.failUnless(uuid in (uuid2,uuid3,uuid4)) self.assertTrue(uuid in (uuid2,uuid3,uuid4))
self.assertEqual(state, CellStates.OUT_OF_DATE) self.assertEqual(state, CellStates.OUT_OF_DATE)
# check each cell # check each cell
# part 1, already outdated # part 1, already outdated
...@@ -190,7 +190,7 @@ class MasterPartitionTableTests(NeoTestBase): ...@@ -190,7 +190,7 @@ class MasterPartitionTableTests(NeoTestBase):
for x in xrange(num_replicas): for x in xrange(num_replicas):
self.assertEqual(len(pt.getCellList(x)), 2) self.assertEqual(len(pt.getCellList(x)), 2)
self.assertEqual(pt.getCellList(x)[0].getState(), CellStates.OUT_OF_DATE) self.assertEqual(pt.getCellList(x)[0].getState(), CellStates.OUT_OF_DATE)
self.failUnless(pt.getCellList(x)[0].getNode() in (sn1, sn2)) self.assertTrue(pt.getCellList(x)[0].getNode() in (sn1, sn2))
# test the most used node is remove from some partition # test the most used node is remove from some partition
uuid3 = self.getNewUUID() uuid3 = self.getNewUUID()
server3 = ("127.0.0.3", 19001) server3 = ("127.0.0.3", 19001)
...@@ -231,9 +231,9 @@ class MasterPartitionTableTests(NeoTestBase): ...@@ -231,9 +231,9 @@ class MasterPartitionTableTests(NeoTestBase):
elif uuid == uuid6: elif uuid == uuid6:
self.assertEqual(state, CellStates.OUT_OF_DATE) self.assertEqual(state, CellStates.OUT_OF_DATE)
else: else:
self.failUnless(uuid in (uuid1, uuid6)) self.assertTrue(uuid in (uuid1, uuid6))
else: else:
self.failUnless(offset in (0, 1)) self.assertTrue(offset in (0, 1))
for x in xrange(num_replicas): for x in xrange(num_replicas):
self.assertEqual(len(pt.getCellList(x)), 2) self.assertEqual(len(pt.getCellList(x)), 2)
# there is a feeding cell, just dropped # there is a feeding cell, just dropped
...@@ -260,9 +260,9 @@ class MasterPartitionTableTests(NeoTestBase): ...@@ -260,9 +260,9 @@ class MasterPartitionTableTests(NeoTestBase):
elif uuid == uuid6: elif uuid == uuid6:
self.assertEqual(state, CellStates.OUT_OF_DATE) self.assertEqual(state, CellStates.OUT_OF_DATE)
else: else:
self.failUnless(uuid in (uuid1, uuid6)) self.assertTrue(uuid in (uuid1, uuid6))
else: else:
self.failUnless(offset in (0, 1)) self.assertTrue(offset in (0, 1))
for x in xrange(num_replicas): for x in xrange(num_replicas):
self.assertEqual(len(pt.getCellList(x)), 3) self.assertEqual(len(pt.getCellList(x)), 3)
# there is no feeding cell, marked as feeding # there is no feeding cell, marked as feeding
...@@ -285,9 +285,9 @@ class MasterPartitionTableTests(NeoTestBase): ...@@ -285,9 +285,9 @@ class MasterPartitionTableTests(NeoTestBase):
elif uuid == uuid6: elif uuid == uuid6:
self.assertEqual(state, CellStates.OUT_OF_DATE) self.assertEqual(state, CellStates.OUT_OF_DATE)
else: else:
self.failUnless(uuid in (uuid1, uuid6)) self.assertTrue(uuid in (uuid1, uuid6))
else: else:
self.failUnless(offset in (0, 1)) self.assertTrue(offset in (0, 1))
for x in xrange(num_replicas): for x in xrange(num_replicas):
self.assertEqual(len(pt.getCellList(x)), 3) self.assertEqual(len(pt.getCellList(x)), 3)
...@@ -332,7 +332,7 @@ class MasterPartitionTableTests(NeoTestBase): ...@@ -332,7 +332,7 @@ class MasterPartitionTableTests(NeoTestBase):
elif uuid == uuid4: elif uuid == uuid4:
self.assertEqual(state, CellStates.OUT_OF_DATE) self.assertEqual(state, CellStates.OUT_OF_DATE)
else: else:
self.failUnless(uuid in (uuid2, uuid4)) self.assertTrue(uuid in (uuid2, uuid4))
for x in xrange(num_replicas): for x in xrange(num_replicas):
self.assertEqual(len(pt.getCellList(x)), 2) self.assertEqual(len(pt.getCellList(x)), 2)
...@@ -390,8 +390,8 @@ class MasterPartitionTableTests(NeoTestBase): ...@@ -390,8 +390,8 @@ class MasterPartitionTableTests(NeoTestBase):
self.assertEqual(len(cells), 2) self.assertEqual(len(cells), 2)
nodes = [x.getNode() for x in cells] nodes = [x.getNode() for x in cells]
for node in nodes: for node in nodes:
self.failUnless(node in (sn1, sn4, sn5)) self.assertTrue(node in (sn1, sn4, sn5))
self.failUnless(node not in (sn2, sn3)) self.assertTrue(node not in (sn2, sn3))
self.assertTrue(pt.filled()) self.assertTrue(pt.filled())
self.assertTrue(pt.operational()) self.assertTrue(pt.operational())
# create a pt with less nodes # create a pt with less nodes
...@@ -471,7 +471,7 @@ class MasterPartitionTableTests(NeoTestBase): ...@@ -471,7 +471,7 @@ class MasterPartitionTableTests(NeoTestBase):
self.assertEqual(cell.getState(), CellStates.UP_TO_DATE) self.assertEqual(cell.getState(), CellStates.UP_TO_DATE)
else: else:
self.assertEqual(cell.getState(), CellStates.OUT_OF_DATE) self.assertEqual(cell.getState(), CellStates.OUT_OF_DATE)
self.failUnless(sn2 in [x.getNode() for x in cells]) self.assertTrue(sn2 in [x.getNode() for x in cells])
# check part 2 # check part 2
cells = pt.getCellList(1) cells = pt.getCellList(1)
...@@ -481,8 +481,8 @@ class MasterPartitionTableTests(NeoTestBase): ...@@ -481,8 +481,8 @@ class MasterPartitionTableTests(NeoTestBase):
self.assertEqual(cell.getState(), CellStates.FEEDING) self.assertEqual(cell.getState(), CellStates.FEEDING)
else: else:
self.assertEqual(cell.getState(), CellStates.OUT_OF_DATE) self.assertEqual(cell.getState(), CellStates.OUT_OF_DATE)
self.failUnless(sn3 in [x.getNode() for x in cells]) self.assertTrue(sn3 in [x.getNode() for x in cells])
self.failUnless(sn1 in [x.getNode() for x in cells]) self.assertTrue(sn1 in [x.getNode() for x in cells])
# check part 3 # check part 3
cells = pt.getCellList(2) cells = pt.getCellList(2)
...@@ -492,8 +492,8 @@ class MasterPartitionTableTests(NeoTestBase): ...@@ -492,8 +492,8 @@ class MasterPartitionTableTests(NeoTestBase):
self.assertEqual(cell.getState(), CellStates.UP_TO_DATE) self.assertEqual(cell.getState(), CellStates.UP_TO_DATE)
else: else:
self.assertEqual(cell.getState(), CellStates.OUT_OF_DATE) self.assertEqual(cell.getState(), CellStates.OUT_OF_DATE)
self.failUnless(sn3 in [x.getNode() for x in cells]) self.assertTrue(sn3 in [x.getNode() for x in cells])
self.failUnless(sn2 in [x.getNode() for x in cells]) self.assertTrue(sn2 in [x.getNode() for x in cells])
# check part 4 # check part 4
cells = pt.getCellList(3) cells = pt.getCellList(3)
...@@ -509,8 +509,8 @@ class MasterPartitionTableTests(NeoTestBase): ...@@ -509,8 +509,8 @@ class MasterPartitionTableTests(NeoTestBase):
self.assertEqual(cell.getState(), CellStates.UP_TO_DATE) self.assertEqual(cell.getState(), CellStates.UP_TO_DATE)
else: else:
self.assertEqual(cell.getState(), CellStates.OUT_OF_DATE) self.assertEqual(cell.getState(), CellStates.OUT_OF_DATE)
self.failUnless(sn1 in [x.getNode() for x in cells]) self.assertTrue(sn1 in [x.getNode() for x in cells])
self.failUnless(sn5 in [x.getNode() for x in cells]) self.assertTrue(sn5 in [x.getNode() for x in cells])
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -107,9 +107,9 @@ class MasterRecoveryTests(NeoTestBase): ...@@ -107,9 +107,9 @@ class MasterRecoveryTests(NeoTestBase):
new_oid = pack('!Q', oid + 1) new_oid = pack('!Q', oid + 1)
upper, lower = unpack('!LL', ltid) upper, lower = unpack('!LL', ltid)
new_tid = pack('!LL', upper, lower + 10) new_tid = pack('!LL', upper, lower + 10)
self.failUnless(new_ptid > self.app.pt.getID()) self.assertTrue(new_ptid > self.app.pt.getID())
self.failUnless(new_oid > self.app.loid) self.assertTrue(new_oid > self.app.loid)
self.failUnless(new_tid > self.app.tm.getLastTID()) self.assertTrue(new_tid > self.app.tm.getLastTID())
self.assertEquals(self.app.target_uuid, None) self.assertEquals(self.app.target_uuid, None)
recovery.answerLastIDs(conn, packet, new_oid, new_tid, new_ptid) recovery.answerLastIDs(conn, packet, new_oid, new_tid, new_ptid)
self.assertEquals(new_oid, self.app.loid) self.assertEquals(new_oid, self.app.loid)
......
...@@ -186,7 +186,7 @@ class MasterStorageHandlerTests(NeoTestBase): ...@@ -186,7 +186,7 @@ class MasterStorageHandlerTests(NeoTestBase):
lptid = self.app.pt.getID() lptid = self.app.pt.getID()
method(conn1) method(conn1)
self.assertEquals(node1.getState(), state) self.assertEquals(node1.getState(), state)
self.failUnless(lptid < self.app.pt.getID()) self.assertTrue(lptid < self.app.pt.getID())
# drop the second, no storage node left # drop the second, no storage node left
lptid = self.app.pt.getID() lptid = self.app.pt.getID()
self.assertEquals(node2.getState(), NodeStates.RUNNING) self.assertEquals(node2.getState(), NodeStates.RUNNING)
......
...@@ -117,9 +117,9 @@ class MasterVerificationTests(NeoTestBase): ...@@ -117,9 +117,9 @@ class MasterVerificationTests(NeoTestBase):
new_oid = pack('!Q', oid + 1) new_oid = pack('!Q', oid + 1)
upper, lower = unpack('!LL', ltid) upper, lower = unpack('!LL', ltid)
new_tid = pack('!LL', upper, lower + 10) new_tid = pack('!LL', upper, lower + 10)
self.failUnless(new_ptid > self.app.pt.getID()) self.assertTrue(new_ptid > self.app.pt.getID())
self.failUnless(new_oid > self.app.loid) self.assertTrue(new_oid > self.app.loid)
self.failUnless(new_tid > self.app.tm.getLastTID()) self.assertTrue(new_tid > self.app.tm.getLastTID())
self.assertRaises(VerificationFailure, verification.answerLastIDs, conn, packet, new_oid, new_tid, new_ptid) self.assertRaises(VerificationFailure, verification.answerLastIDs, conn, packet, new_oid, new_tid, new_ptid)
self.assertNotEquals(new_oid, self.app.loid) self.assertNotEquals(new_oid, self.app.loid)
self.assertNotEquals(new_tid, self.app.tm.getLastTID()) self.assertNotEquals(new_tid, self.app.tm.getLastTID())
......
...@@ -114,12 +114,12 @@ class StorageAppTests(NeoTestBase): ...@@ -114,12 +114,12 @@ class StorageAppTests(NeoTestBase):
self.assertEqual(cell_list[0].getUUID(), client_uuid) self.assertEqual(cell_list[0].getUUID(), client_uuid)
cell_list = self.app.pt.getCellList(1) cell_list = self.app.pt.getCellList(1)
self.assertEqual(len(cell_list), 2) self.assertEqual(len(cell_list), 2)
self.failUnless(cell_list[0].getUUID() in (client_uuid, storage_uuid)) self.assertTrue(cell_list[0].getUUID() in (client_uuid, storage_uuid))
self.failUnless(cell_list[1].getUUID() in (client_uuid, storage_uuid)) self.assertTrue(cell_list[1].getUUID() in (client_uuid, storage_uuid))
cell_list = self.app.pt.getCellList(2) cell_list = self.app.pt.getCellList(2)
self.assertEqual(len(cell_list), 2) self.assertEqual(len(cell_list), 2)
self.failUnless(cell_list[0].getUUID() in (master_uuid, storage_uuid)) self.assertTrue(cell_list[0].getUUID() in (master_uuid, storage_uuid))
self.failUnless(cell_list[1].getUUID() in (master_uuid, storage_uuid)) self.assertTrue(cell_list[1].getUUID() in (master_uuid, storage_uuid))
def test_02_queueEvent(self): def test_02_queueEvent(self):
self.assertEqual(len(self.app.event_queue), 0) self.assertEqual(len(self.app.event_queue), 0)
......
...@@ -79,7 +79,7 @@ class ConnectionTests(NeoTestBase): ...@@ -79,7 +79,7 @@ class ConnectionTests(NeoTestBase):
# add connector # add connector
connector = bc.connector_handler() connector = bc.connector_handler()
bc.setConnector(connector) bc.setConnector(connector)
self.failUnless(isinstance(bc.getConnector(), DoNothingConnector)) self.assertTrue(isinstance(bc.getConnector(), DoNothingConnector))
self.assertNotEqual(bc.getConnector(), None) self.assertNotEqual(bc.getConnector(), None)
# check it registered the connection in epoll # check it registered the connection in epoll
self.assertEquals(len(em.mockGetNamedCalls("register")), 1) self.assertEquals(len(em.mockGetNamedCalls("register")), 1)
...@@ -164,7 +164,7 @@ class ConnectionTests(NeoTestBase): ...@@ -164,7 +164,7 @@ class ConnectionTests(NeoTestBase):
next_id = bc._getNextId() next_id = bc._getNextId()
self.assertEqual(next_id, cur_id) self.assertEqual(next_id, cur_id)
next_id = bc._getNextId() next_id = bc._getNextId()
self.failUnless(next_id > cur_id) self.assertTrue(next_id > cur_id)
# test overflow of next id # test overflow of next id
bc.cur_id = 0xffffffff bc.cur_id = 0xffffffff
next_id = bc._getNextId() next_id = bc._getNextId()
...@@ -959,7 +959,7 @@ class ConnectionTests(NeoTestBase): ...@@ -959,7 +959,7 @@ class ConnectionTests(NeoTestBase):
next_id = bc._getNextId() next_id = bc._getNextId()
self.assertEqual(next_id, cur_id) self.assertEqual(next_id, cur_id)
next_id = bc._getNextId() next_id = bc._getNextId()
self.failUnless(next_id > cur_id) self.assertTrue(next_id > cur_id)
# test overflow of next id # test overflow of next id
bc.cur_id = 0xffffffff bc.cur_id = 0xffffffff
next_id = bc._getNextId() next_id = bc._getNextId()
...@@ -1083,7 +1083,7 @@ class ConnectionTests(NeoTestBase): ...@@ -1083,7 +1083,7 @@ class ConnectionTests(NeoTestBase):
next_id = bc._getNextId() next_id = bc._getNextId()
self.assertEqual(next_id, cur_id) self.assertEqual(next_id, cur_id)
next_id = bc._getNextId() next_id = bc._getNextId()
self.failUnless(next_id > cur_id) self.assertTrue(next_id > cur_id)
# test overflow of next id # test overflow of next id
bc.cur_id = 0xffffffff bc.cur_id = 0xffffffff
next_id = bc._getNextId() next_id = bc._getNextId()
......
...@@ -36,7 +36,7 @@ class EventTests(NeoTestBase): ...@@ -36,7 +36,7 @@ class EventTests(NeoTestBase):
self.assertEqual(len(em.reader_set), 0) self.assertEqual(len(em.reader_set), 0)
self.assertEqual(len(em.writer_set), 0) self.assertEqual(len(em.writer_set), 0)
self.assertEqual(len(em.event_list), 0) self.assertEqual(len(em.event_list), 0)
self.failUnless(em.prev_time <time) self.assertTrue(em.prev_time <time)
self.assertTrue(isinstance(em.epoll, Epoll)) self.assertTrue(isinstance(em.epoll, Epoll))
# use a mock object instead of epoll # use a mock object instead of epoll
em.epoll = Mock() em.epoll = Mock()
...@@ -160,7 +160,7 @@ class EventTests(NeoTestBase): ...@@ -160,7 +160,7 @@ class EventTests(NeoTestBase):
# call with time < t < critical_time # call with time < t < critical_time
t = time + 5 t = time + 5
self.failUnless(t < critical_time) self.assertTrue(t < critical_time)
r = event(t) r = event(t)
self.assertTrue(r) self.assertTrue(r)
self.assertEquals(len(conn.mockGetNamedCalls("lock")), 1) self.assertEquals(len(conn.mockGetNamedCalls("lock")), 1)
...@@ -173,7 +173,7 @@ class EventTests(NeoTestBase): ...@@ -173,7 +173,7 @@ class EventTests(NeoTestBase):
# call with time < critical_time < t # call with time < critical_time < t
t = critical_time + 5 t = critical_time + 5
self.failUnless(t > critical_time) self.assertTrue(t > critical_time)
r = event(t) r = event(t)
self.assertTrue(r) self.assertTrue(r)
self.assertEquals(len(conn.mockGetNamedCalls("lock")), 2) self.assertEquals(len(conn.mockGetNamedCalls("lock")), 2)
...@@ -211,7 +211,7 @@ class EventTests(NeoTestBase): ...@@ -211,7 +211,7 @@ class EventTests(NeoTestBase):
# call with time < t < critical_time # call with time < t < critical_time
t = time + 1 t = time + 1
self.failUnless(t < critical_time) self.assertTrue(t < critical_time)
r = event(t) r = event(t)
self.assertTrue(r) self.assertTrue(r)
self.assertEquals(len(conn.mockGetNamedCalls("lock")), 1) self.assertEquals(len(conn.mockGetNamedCalls("lock")), 1)
...@@ -224,7 +224,7 @@ class EventTests(NeoTestBase): ...@@ -224,7 +224,7 @@ class EventTests(NeoTestBase):
# call with time < critical_time < t # call with time < critical_time < t
t = critical_time + 5 t = critical_time + 5
self.failUnless(t > critical_time) self.assertTrue(t > critical_time)
r = event(t) r = event(t)
self.assertTrue(r) self.assertTrue(r)
self.assertEquals(len(conn.mockGetNamedCalls("lock")), 2) self.assertEquals(len(conn.mockGetNamedCalls("lock")), 2)
......
...@@ -192,34 +192,34 @@ class PartitionTableTests(NeoTestBase): ...@@ -192,34 +192,34 @@ class PartitionTableTests(NeoTestBase):
all_cell = pt.getCellList(0) all_cell = pt.getCellList(0)
all_nodes = [x.getNode() for x in all_cell] all_nodes = [x.getNode() for x in all_cell]
self.assertEqual(len(all_cell), 3) self.assertEqual(len(all_cell), 3)
self.failUnless(sn1 in all_nodes) self.assertTrue(sn1 in all_nodes)
self.failUnless(sn2 in all_nodes) self.assertTrue(sn2 in all_nodes)
self.failUnless(sn3 in all_nodes) self.assertTrue(sn3 in all_nodes)
self.failUnless(sn4 not in all_nodes) self.assertTrue(sn4 not in all_nodes)
# writable nodes # writable nodes
all_cell = pt.getCellList(0, writable=True) all_cell = pt.getCellList(0, writable=True)
all_nodes = [x.getNode() for x in all_cell] all_nodes = [x.getNode() for x in all_cell]
self.assertEqual(len(all_cell), 3) self.assertEqual(len(all_cell), 3)
self.failUnless(sn1 in all_nodes) self.assertTrue(sn1 in all_nodes)
self.failUnless(sn2 in all_nodes) self.assertTrue(sn2 in all_nodes)
self.failUnless(sn3 in all_nodes) self.assertTrue(sn3 in all_nodes)
self.failUnless(sn4 not in all_nodes) self.assertTrue(sn4 not in all_nodes)
# readable nodes # readable nodes
all_cell = pt.getCellList(0, readable=True) all_cell = pt.getCellList(0, readable=True)
all_nodes = [x.getNode() for x in all_cell] all_nodes = [x.getNode() for x in all_cell]
self.assertEqual(len(all_cell), 2) self.assertEqual(len(all_cell), 2)
self.failUnless(sn1 in all_nodes) self.assertTrue(sn1 in all_nodes)
self.failUnless(sn2 not in all_nodes) self.assertTrue(sn2 not in all_nodes)
self.failUnless(sn3 in all_nodes) self.assertTrue(sn3 in all_nodes)
self.failUnless(sn4 not in all_nodes) self.assertTrue(sn4 not in all_nodes)
# writable & readable nodes # writable & readable nodes
all_cell = pt.getCellList(0, readable=True, writable=True) all_cell = pt.getCellList(0, readable=True, writable=True)
all_nodes = [x.getNode() for x in all_cell] all_nodes = [x.getNode() for x in all_cell]
self.assertEqual(len(all_cell), 2) self.assertEqual(len(all_cell), 2)
self.failUnless(sn1 in all_nodes) self.assertTrue(sn1 in all_nodes)
self.failUnless(sn2 not in all_nodes) self.assertTrue(sn2 not in all_nodes)
self.failUnless(sn3 in all_nodes) self.assertTrue(sn3 in all_nodes)
self.failUnless(sn4 not in all_nodes) self.assertTrue(sn4 not in all_nodes)
else: else:
self.assertEqual(len(pt.getCellList(1, False)), 0) self.assertEqual(len(pt.getCellList(1, False)), 0)
self.assertEqual(len(pt.getCellList(1, True)), 0) self.assertEqual(len(pt.getCellList(1, True)), 0)
...@@ -251,7 +251,7 @@ class PartitionTableTests(NeoTestBase): ...@@ -251,7 +251,7 @@ class PartitionTableTests(NeoTestBase):
self.assertEqual(len(partition_list), num_partitions) self.assertEqual(len(partition_list), num_partitions)
for x in xrange(num_partitions): for x in xrange(num_partitions):
part = partition_list[x] part = partition_list[x]
self.failUnless(isinstance(part, list)) self.assertTrue(isinstance(part, list))
self.assertEqual(len(part), 0) self.assertEqual(len(part), 0)
self.assertEqual(len(pt.count_dict), 0) self.assertEqual(len(pt.count_dict), 0)
...@@ -280,10 +280,10 @@ class PartitionTableTests(NeoTestBase): ...@@ -280,10 +280,10 @@ class PartitionTableTests(NeoTestBase):
# into account # into account
self.assertEqual(len(pt.getNodeList()), 2) self.assertEqual(len(pt.getNodeList()), 2)
nodes = pt.getNodeList() nodes = pt.getNodeList()
self.failUnless(sn1 in nodes) self.assertTrue(sn1 in nodes)
self.failUnless(sn2 in nodes) self.assertTrue(sn2 in nodes)
self.failUnless(sn3 not in nodes) self.assertTrue(sn3 not in nodes)
self.failUnless(sn4 not in nodes) self.assertTrue(sn4 not in nodes)
def test_08_filled(self): def test_08_filled(self):
num_partitions = 5 num_partitions = 5
...@@ -400,12 +400,12 @@ class PartitionTableTests(NeoTestBase): ...@@ -400,12 +400,12 @@ class PartitionTableTests(NeoTestBase):
row_0 = pt.getRow(0) row_0 = pt.getRow(0)
self.assertEqual(len(row_0), 3) self.assertEqual(len(row_0), 3)
for uuid, state in row_0: for uuid, state in row_0:
self.failUnless(uuid in (sn1.getUUID(), sn2.getUUID(), sn3.getUUID())) self.assertTrue(uuid in (sn1.getUUID(), sn2.getUUID(), sn3.getUUID()))
self.assertEqual(state, CellStates.UP_TO_DATE) self.assertEqual(state, CellStates.UP_TO_DATE)
row_1 = pt.getRow(1) row_1 = pt.getRow(1)
self.assertEqual(len(row_1), 2) self.assertEqual(len(row_1), 2)
for uuid, state in row_1: for uuid, state in row_1:
self.failUnless(uuid in (sn1.getUUID(), sn2.getUUID())) self.assertTrue(uuid in (sn1.getUUID(), sn2.getUUID()))
self.assertEqual(state, CellStates.UP_TO_DATE) self.assertEqual(state, CellStates.UP_TO_DATE)
row_2 = pt.getRow(2) row_2 = pt.getRow(2)
self.assertEqual(len(row_2), 1) self.assertEqual(len(row_2), 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment