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