summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-11-02 20:47:33 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2009-11-02 20:47:33 (GMT)
commitc6714bd1df0bf3aa466366ce45fe0152d6deac42 (patch)
treeddf3118802d9d8f630b407a4757f6c45213a6c12 /Lib/test
parent28e463d1315c6042095ccd15abe87f59ea49314b (diff)
downloadcpython-c6714bd1df0bf3aa466366ce45fe0152d6deac42.zip
cpython-c6714bd1df0bf3aa466366ce45fe0152d6deac42.tar.gz
cpython-c6714bd1df0bf3aa466366ce45fe0152d6deac42.tar.bz2
Add acceptance of long ints to test_memoryio.py
(in preparation for fix of #7249 in 2.6)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_memoryio.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/Lib/test/test_memoryio.py b/Lib/test/test_memoryio.py
index e55a811..96c2b8c 100644
--- a/Lib/test/test_memoryio.py
+++ b/Lib/test/test_memoryio.py
@@ -124,6 +124,9 @@ class MemoryTestMixin:
self.assertEqual(memio.getvalue(), buf[:6])
self.assertEqual(memio.truncate(4), 4)
self.assertEqual(memio.getvalue(), buf[:4])
+ # truncate() accepts long objects
+ self.assertEqual(memio.truncate(4L), 4)
+ self.assertEqual(memio.getvalue(), buf[:4])
self.assertEqual(memio.tell(), 4)
memio.write(buf)
self.assertEqual(memio.getvalue(), buf[:4] + buf)
@@ -153,7 +156,8 @@ class MemoryTestMixin:
self.assertEqual(memio.read(0), self.EOF)
self.assertEqual(memio.read(1), buf[:1])
- self.assertEqual(memio.read(4), buf[1:5])
+ # read() accepts long objects
+ self.assertEqual(memio.read(4L), buf[1:5])
self.assertEqual(memio.read(900), buf[5:])
self.assertEqual(memio.read(), self.EOF)
memio.seek(0)
@@ -184,7 +188,8 @@ class MemoryTestMixin:
self.assertEqual(memio.readline(), self.EOF)
memio.seek(0)
self.assertEqual(memio.readline(5), buf[:5])
- self.assertEqual(memio.readline(5), buf[5:10])
+ # readline() accepts long objects
+ self.assertEqual(memio.readline(5L), buf[5:10])
self.assertEqual(memio.readline(5), buf[10:15])
memio.seek(0)
self.assertEqual(memio.readline(-1), buf)
@@ -212,7 +217,8 @@ class MemoryTestMixin:
memio.seek(5)
self.assertEqual(memio.readlines(), [buf[5:]] + [buf] * 9)
memio.seek(0)
- self.assertEqual(memio.readlines(15), [buf] * 2)
+ # readlines() accepts long objects
+ self.assertEqual(memio.readlines(15L), [buf] * 2)
memio.seek(0)
self.assertEqual(memio.readlines(-1), [buf] * 10)
memio.seek(0)
@@ -273,6 +279,8 @@ class MemoryTestMixin:
self.assertEqual(memio.seek(0, 0), 0)
self.assertEqual(memio.read(), buf)
self.assertEqual(memio.seek(3), 3)
+ # seek() accepts long objects
+ self.assertEqual(memio.seek(3L), 3)
self.assertEqual(memio.seek(0, 1), 3)
self.assertEqual(memio.read(), buf[3:])
self.assertEqual(memio.seek(len(buf)), len(buf))