Update of /cvsroot/pywin32/pywin32/com/win32com/test
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14189/win32com/test
Modified Files:
testStreams.py
Log Message:
py3k-friendly bytes handling
Index: testStreams.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testStreams.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** testStreams.py 26 Nov 2008 08:52:32 -0000 1.7
--- testStreams.py 19 Dec 2008 01:52:15 -0000 1.8
***************
*** 10,14 ****
_com_interfaces_ = [ pythoncom.IID_IPersistStreamInit ]
def __init__(self):
! self.data = "abcdefg"
self.dirty = 1
def GetClassID(self):
--- 10,14 ----
_com_interfaces_ = [ pythoncom.IID_IPersistStreamInit ]
def __init__(self):
! self.data = "abcdefg".encode("ascii")
self.dirty = 1
def GetClassID(self):
***************
*** 67,71 ****
"""
def Read(self, amount):
! return 'x'*(amount+1)
class StreamTest(win32com.test.util.TestCase):
--- 67,71 ----
"""
def Read(self, amount):
! return 'x'.encode('ascii')*(amount+1)
class StreamTest(win32com.test.util.TestCase):
***************
*** 81,85 ****
def testit(self):
! mydata = 'abcdefghijklmnopqrstuvwxyz'
# First test the objects just as Python objects...
--- 81,85 ----
def testit(self):
! mydata = 'abcdefghijklmnopqrstuvwxyz'.encode('ascii')
# First test the objects just as Python objects...
***************
*** 90,94 ****
p.Save(s, 0)
self.assertEqual(s.data, mydata)
!
# Wrap the Python objects as COM objects, and make the calls as if
# they were non-Python COM objects.
--- 90,94 ----
p.Save(s, 0)
self.assertEqual(s.data, mydata)
!
# Wrap the Python objects as COM objects, and make the calls as if
# they were non-Python COM objects.
***************
*** 101,105 ****
self._readWrite(mydata, s2, s2)
! self._readWrite("string with\0a NULL", s2, s2)
# reset the stream
s.Write(mydata)
--- 101,105 ----
self._readWrite(mydata, s2, s2)
! self._readWrite("string with\0a NULL".encode('ascii'), s2, s2)
# reset the stream
s.Write(mydata)
***************
*** 108,111 ****
--- 108,112 ----
self.assertEqual(s.data, mydata)
+ def testerrors(self):
# setup a test logger to capture tracebacks etc.
records, old_log = win32com.test.util.setup_test_logger()
|