Commit 80f0c824 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Fixed and optimized a test of issue #22526.

parent 987a02b5
......@@ -14,7 +14,7 @@ except ImportError:
threading = None
from test import test_support
from test.test_support import TESTFN, run_unittest
from test.test_support import TESTFN, run_unittest, requires
from UserList import UserList
class AutoFileTests(unittest.TestCase):
......@@ -437,16 +437,18 @@ class OtherFileTests(unittest.TestCase):
f.close()
@unittest.skipUnless(sys.maxsize > 2**31, "requires 64-bit system")
@test_support.precisionbigmemtest(2**31, 1)
def test_very_long_line(self, maxsize):
@test_support.precisionbigmemtest(2**31, 2.5, dry_run=False)
def test_very_long_line(self, size):
# Issue #22526
requires('largefile')
with open(TESTFN, "wb") as fp:
fp.write("\0"*2**31)
fp.seek(size - 1)
fp.write("\0")
with open(TESTFN, "rb") as fp:
for l in fp:
pass
self.assertEqual(len(l), 2**31)
self.assertEqual(l.count("\0"), 2**31)
self.assertEqual(len(l), size)
self.assertEqual(l.count("\0"), size)
l = None
class FileSubclassTests(unittest.TestCase):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment