Commit 1ab594b4 authored by Julien Muchembled's avatar Julien Muchembled

Remove useless assert in a private method of MTClientConnection

parent d898a83d
...@@ -468,12 +468,12 @@ class Connection(BaseConnection): ...@@ -468,12 +468,12 @@ class Connection(BaseConnection):
def readable(self): def readable(self):
"""Called when self is readable.""" """Called when self is readable."""
self._recv() self._recv()
self.analyse() self._analyse()
if self.aborted: if self.aborted:
self.em.removeReader(self) self.em.removeReader(self)
return not not self._queue return not not self._queue
def analyse(self): def _analyse(self):
"""Analyse received data.""" """Analyse received data."""
try: try:
while True: while True:
...@@ -728,7 +728,7 @@ class MTConnectionType(type): ...@@ -728,7 +728,7 @@ class MTConnectionType(type):
def __init__(cls, *args): def __init__(cls, *args):
if __debug__: if __debug__:
for name in 'analyse', 'answer': for name in 'answer',:
setattr(cls, name, cls.lockCheckWrapper(name)) setattr(cls, name, cls.lockCheckWrapper(name))
for name in ('_delayedConnect', 'close', 'notify', 'onTimeout', for name in ('_delayedConnect', 'close', 'notify', 'onTimeout',
'process', 'readable', 'writable'): 'process', 'readable', 'writable'):
......
...@@ -376,7 +376,7 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -376,7 +376,7 @@ class ConnectionTests(NeoUnitTestBase):
bc = self._makeConnection() bc = self._makeConnection()
bc._queue = Mock() bc._queue = Mock()
self._checkReadBuf(bc, '') self._checkReadBuf(bc, '')
bc.analyse() bc._analyse()
self._checkPacketReceived(0) self._checkPacketReceived(0)
self._checkReadBuf(bc, '') self._checkReadBuf(bc, '')
...@@ -387,13 +387,13 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -387,13 +387,13 @@ class ConnectionTests(NeoUnitTestBase):
p_data_1, p_data_2 = p_data[:data_edge], p_data[data_edge:] p_data_1, p_data_2 = p_data[:data_edge], p_data[data_edge:]
# append an incomplete packet, nothing is done # append an incomplete packet, nothing is done
bc.read_buf.append(p_data_1) bc.read_buf.append(p_data_1)
bc.analyse() bc._analyse()
self._checkPacketReceived(0) self._checkPacketReceived(0)
self.assertNotEqual(len(bc.read_buf), 0) self.assertNotEqual(len(bc.read_buf), 0)
self.assertNotEqual(len(bc.read_buf), len(p_data)) self.assertNotEqual(len(bc.read_buf), len(p_data))
# append the rest of the packet # append the rest of the packet
bc.read_buf.append(p_data_2) bc.read_buf.append(p_data_2)
bc.analyse() bc._analyse()
# check packet decoded # check packet decoded
self.assertEqual(len(bc._queue.mockGetNamedCalls("append")), 1) self.assertEqual(len(bc._queue.mockGetNamedCalls("append")), 1)
call = bc._queue.mockGetNamedCalls("append")[0] call = bc._queue.mockGetNamedCalls("append")[0]
...@@ -414,7 +414,7 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -414,7 +414,7 @@ class ConnectionTests(NeoUnitTestBase):
p2.setId(2) p2.setId(2)
self._appendPacketToReadBuf(bc, p2) self._appendPacketToReadBuf(bc, p2)
self.assertEqual(len(bc.read_buf), len(p1) + len(p2)) self.assertEqual(len(bc.read_buf), len(p1) + len(p2))
bc.analyse() bc._analyse()
# check two packets decoded # check two packets decoded
self.assertEqual(len(bc._queue.mockGetNamedCalls("append")), 2) self.assertEqual(len(bc._queue.mockGetNamedCalls("append")), 2)
# packet 1 # packet 1
...@@ -437,7 +437,7 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -437,7 +437,7 @@ class ConnectionTests(NeoUnitTestBase):
p = Packets.Ping() p = Packets.Ping()
p.setId(1) p.setId(1)
self._appendToReadBuf(bc, '%s%sdatadatadatadata' % p.encode()) self._appendToReadBuf(bc, '%s%sdatadatadatadata' % p.encode())
bc.analyse() bc._analyse()
self._checkPacketReceived(1) # ping packet self._checkPacketReceived(1) # ping packet
self._checkClose(1) # malformed packet self._checkClose(1) # malformed packet
...@@ -448,7 +448,7 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -448,7 +448,7 @@ class ConnectionTests(NeoUnitTestBase):
p = Packets.AnswerPrimary(self.getNewUUID(None)) p = Packets.AnswerPrimary(self.getNewUUID(None))
p.setId(1) p.setId(1)
self._appendPacketToReadBuf(bc, p) self._appendPacketToReadBuf(bc, p)
bc.analyse() bc._analyse()
# check packet decoded # check packet decoded
self.assertEqual(len(bc._queue.mockGetNamedCalls("append")), 1) self.assertEqual(len(bc._queue.mockGetNamedCalls("append")), 1)
call = bc._queue.mockGetNamedCalls("append")[0] call = bc._queue.mockGetNamedCalls("append")[0]
......
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