From: Serhiy Storchaka Date: Sun, 12 Oct 2014 14:13:06 +0000 (+0300) Subject: Fixed and optimized a test of issue #22526. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=80f0c824bae1b9a12f44e1a3afbdc6f7cd50f0f8;p=python Fixed and optimized a test of issue #22526. --- diff --git a/Lib/test/test_file2k.py b/Lib/test/test_file2k.py index cab4079c3e..3803950811 100644 --- a/Lib/test/test_file2k.py +++ b/Lib/test/test_file2k.py @@ -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):