summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ssl.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-11-25 18:55:32 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2009-11-25 18:55:32 (GMT)
commit7d7aede558bc93196a40bd00fd857f57d00dd5bc (patch)
treeb5f8b100bac2a4beee4f45403ba74ddf9da3b264 /Lib/test/test_ssl.py
parentb742a96c523339d640ca9dc3d077ef9b6ec13d8e (diff)
downloadcpython-7d7aede558bc93196a40bd00fd857f57d00dd5bc.zip
cpython-7d7aede558bc93196a40bd00fd857f57d00dd5bc.tar.gz
cpython-7d7aede558bc93196a40bd00fd857f57d00dd5bc.tar.bz2
Merged revisions 75529 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r75529 | antoine.pitrou | 2009-10-19 19:59:07 +0200 (lun., 19 oct. 2009) | 5 lines Issue #7133: SSL objects now support the new buffer API. This fixes the test_ssl failure. ........
Diffstat (limited to 'Lib/test/test_ssl.py')
-rw-r--r--Lib/test/test_ssl.py32
1 files changed, 17 insertions, 15 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 0be5652..383c78a 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -651,21 +651,23 @@ else:
except Exception as x:
raise support.TestFailed("Unexpected exception: " + str(x))
else:
- if connectionchatty:
- if support.verbose:
- sys.stdout.write(
- " client: sending %s...\n" % (repr(indata)))
- s.write(indata.encode('ASCII', 'strict'))
- outdata = s.read()
- if connectionchatty:
- if support.verbose:
- sys.stdout.write(" client: read %s\n" % repr(outdata))
- outdata = str(outdata, 'ASCII', 'strict')
- if outdata != indata.lower():
- raise support.TestFailed(
- "bad data <<%s>> (%d) received; expected <<%s>> (%d)\n"
- % (repr(outdata[:min(len(outdata),20)]), len(outdata),
- repr(indata[:min(len(indata),20)].lower()), len(indata)))
+ bindata = indata.encode('ASCII', 'strict')
+ for arg in [bindata, bytearray(bindata), memoryview(bindata)]:
+ if connectionchatty:
+ if support.verbose:
+ sys.stdout.write(
+ " client: sending %s...\n" % (repr(indata)))
+ s.write(arg)
+ outdata = s.read()
+ if connectionchatty:
+ if support.verbose:
+ sys.stdout.write(" client: read %s\n" % repr(outdata))
+ outdata = str(outdata, 'ASCII', 'strict')
+ if outdata != indata.lower():
+ raise support.TestFailed(
+ "bad data <<%s>> (%d) received; expected <<%s>> (%d)\n"
+ % (repr(outdata[:min(len(outdata),20)]), len(outdata),
+ repr(indata[:min(len(indata),20)].lower()), len(indata)))
s.write("over\n".encode("ASCII", "strict"))
if connectionchatty:
if support.verbose: