Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefane Fermigier
neo
Commits
1ab594b4
Commit
1ab594b4
authored
Aug 12, 2015
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove useless assert in a private method of MTClientConnection
parent
d898a83d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
neo/lib/connection.py
neo/lib/connection.py
+3
-3
neo/tests/testConnection.py
neo/tests/testConnection.py
+6
-6
No files found.
neo/lib/connection.py
View file @
1ab594b4
...
@@ -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
'an
alyse'
,
'answer'
:
for
name
in
'an
swer'
,
:
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'
):
...
...
neo/tests/testConnection.py
View file @
1ab594b4
...
@@ -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
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment