summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_largefile.py
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2008-03-03 02:59:49 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2008-03-03 02:59:49 (GMT)
commita351f7701a6d9e0648b4d108821ebd4ce7b38fee (patch)
tree4797bdff37569b8fbc6ab7722444592b6b248f55 /Lib/test/test_largefile.py
parent7f757edf15d130f82149c2133974056db1be201e (diff)
downloadcpython-a351f7701a6d9e0648b4d108821ebd4ce7b38fee.zip
cpython-a351f7701a6d9e0648b4d108821ebd4ce7b38fee.tar.gz
cpython-a351f7701a6d9e0648b4d108821ebd4ce7b38fee.tar.bz2
Fixed failing unit tests due to str/bytes mismatch.
Changed "assert isinstance(...)" in hmac.py to raise proper TypeError.
Diffstat (limited to 'Lib/test/test_largefile.py')
-rw-r--r--Lib/test/test_largefile.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/test/test_largefile.py b/Lib/test/test_largefile.py
index 8157ddb..d1e02ed 100644
--- a/Lib/test/test_largefile.py
+++ b/Lib/test/test_largefile.py
@@ -31,10 +31,10 @@ class TestCase(unittest.TestCase):
print('create large file via seek (may be sparse file) ...')
f = open(TESTFN, 'wb')
try:
- f.write('z')
+ f.write(b'z')
f.seek(0)
f.seek(size)
- f.write('a')
+ f.write(b'a')
f.flush()
if verbose:
print('check file size with os.fstat')
@@ -53,7 +53,7 @@ class TestCase(unittest.TestCase):
f = open(TESTFN, 'rb')
try:
self.assertEqual(f.tell(), 0)
- self.assertEqual(f.read(1), 'z')
+ self.assertEqual(f.read(1), b'z')
self.assertEqual(f.tell(), 1)
f.seek(0)
self.assertEqual(f.tell(), 0)
@@ -76,9 +76,9 @@ class TestCase(unittest.TestCase):
f.seek(size)
self.assertEqual(f.tell(), size)
# the 'a' that was written at the end of file above
- self.assertEqual(f.read(1), 'a')
+ self.assertEqual(f.read(1), b'a')
f.seek(-size-1, 1)
- self.assertEqual(f.read(1), 'z')
+ self.assertEqual(f.read(1), b'z')
self.assertEqual(f.tell(), 1)
finally:
f.close()
@@ -97,7 +97,7 @@ class TestCase(unittest.TestCase):
self.assertEqual(os.lseek(f.fileno(), -size-1, 2), 0)
self.assertEqual(os.lseek(f.fileno(), size, 0), size)
# the 'a' that was written at the end of file above
- self.assertEqual(f.read(1), 'a')
+ self.assertEqual(f.read(1), b'a')
finally:
f.close()
@@ -155,7 +155,7 @@ def main_test():
f.seek(2147483649)
# Seeking is not enough of a test: you must write and
# flush, too!
- f.write("x")
+ f.write(b'x')
f.flush()
except (IOError, OverflowError):
f.close()