summaryrefslogtreecommitdiffhomepage
path: root/tests/loop.py
diff options
context:
space:
mode:
authorBobby Impollonia <bobby@affinesystems.com>2012-03-10 18:10:23 -0800
committerJeff Forcier <jeff@bitprophet.org>2012-09-23 16:18:57 -0700
commitae3ecbe5487d3948a8c4e13d8f0e7fd86f387f80 (patch)
tree8e291c42fa7a58ddc65b0c8f45d33bc3e65f87e0 /tests/loop.py
parentbd5c843040a9c183e1ce39afd65a519749eaa8db (diff)
Remove comparison between int and str
The code had been doing 'n < self.__in_buffer' when it wanted to be doing 'n < len(self.__in_buffer)' In Python 2.x, this comparison (int < str) is always True. I found this while porting to Python 3 where it raises an error. The code has been working without complaints because always taking the true branch of this conditional is actually fine. We don't need the false branch, so drop the check entirely. (cherry picked from commit 0a013f829e9eb20fb037a2ac06c230d9074fbe90)
Diffstat (limited to 'tests/loop.py')
-rw-r--r--tests/loop.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/tests/loop.py b/tests/loop.py
index bdc2f2da..ffa8e3c4 100644
--- a/tests/loop.py
+++ b/tests/loop.py
@@ -62,12 +62,8 @@ class LoopSocket (object):
self.__cv.wait(self.__timeout)
if len(self.__in_buffer) == 0:
raise socket.timeout
- if n < self.__in_buffer:
- out = self.__in_buffer[:n]
- self.__in_buffer = self.__in_buffer[n:]
- else:
- out = self.__in_buffer
- self.__in_buffer = ''
+ out = self.__in_buffer[:n]
+ self.__in_buffer = self.__in_buffer[n:]
return out
finally:
self.__lock.release()