diff options
author | Guido van Rossum <guido@python.org> | 2007-07-12 07:58:54 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-07-12 07:58:54 (GMT) |
commit | 076da0957b1af50cccf40ec5c60742212b4a1f90 (patch) | |
tree | 249b3131cfd00f85e76e7ece18b0ff93cabe8cff /Lib/test/test_asynchat.py | |
parent | e7a0d3997846155e1a9dcd95eb559039da34ee08 (diff) | |
download | cpython-076da0957b1af50cccf40ec5c60742212b4a1f90.zip cpython-076da0957b1af50cccf40ec5c60742212b4a1f90.tar.gz cpython-076da0957b1af50cccf40ec5c60742212b4a1f90.tar.bz2 |
Fix asynchat to use bytes instead of strings.
Fix by Alexandre Vassalotti, SF# 1752173.
Diffstat (limited to 'Lib/test/test_asynchat.py')
-rw-r--r-- | Lib/test/test_asynchat.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/test/test_asynchat.py b/Lib/test/test_asynchat.py index 6bcedd6..7629296 100644 --- a/Lib/test/test_asynchat.py +++ b/Lib/test/test_asynchat.py @@ -17,8 +17,8 @@ class echo_server(threading.Thread): PORT = test_support.bind_port(sock, HOST, PORT) sock.listen(1) conn, client = sock.accept() - buffer = "" - while "\n" not in buffer: + buffer = b"" + while b"\n" not in buffer: data = conn.recv(1) if not data: break @@ -37,7 +37,7 @@ class echo_client(asynchat.async_chat): self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.connect((HOST, PORT)) self.set_terminator(terminator) - self.buffer = "" + self.buffer = b"" def handle_connect(self): pass @@ -49,7 +49,7 @@ class echo_client(asynchat.async_chat): def found_terminator(self): #print "Received:", repr(self.buffer) self.contents = self.buffer - self.buffer = "" + self.buffer = b"" self.close() @@ -70,7 +70,7 @@ class TestAsynchat(unittest.TestCase): asyncore.loop() s.join() - self.assertEqual(c.contents, 'hello world') + self.assertEqual(c.contents, b'hello world') def test_numeric_terminator(self): # Try reading a fixed number of bytes @@ -83,7 +83,7 @@ class TestAsynchat(unittest.TestCase): asyncore.loop() s.join() - self.assertEqual(c.contents, 'hello ') + self.assertEqual(c.contents, b'hello ') def test_main(verbose=None): |