mcst-linux-kernel/patches-2024.06.26/python-stdlib-extensions-2..../0005-skip-if-sys.maxsize-lo...

50 lines
2.1 KiB
Diff

From cc15e92905306ee8f554e7cfdfc5feb2063ecbaf Mon Sep 17 00:00:00 2001
Date: Fri, 12 Apr 2019 14:41:38 +0300
Subject: [PATCH] skip if sys.maxsize lower than 0x7FFFFFFF
---
Lib/test/test_io.py | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index ea5ec65..183f3a0 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -322,19 +322,20 @@ class IOTest(unittest.TestCase):
def large_file_ops(self, f):
assert f.readable()
assert f.writable()
- self.assertEqual(f.seek(self.LARGE), self.LARGE)
- self.assertEqual(f.tell(), self.LARGE)
- self.assertEqual(f.write(b"xxx"), 3)
- self.assertEqual(f.tell(), self.LARGE + 3)
- self.assertEqual(f.seek(-1, 1), self.LARGE + 2)
- self.assertEqual(f.truncate(), self.LARGE + 2)
- self.assertEqual(f.tell(), self.LARGE + 2)
- self.assertEqual(f.seek(0, 2), self.LARGE + 2)
- self.assertEqual(f.truncate(self.LARGE + 1), self.LARGE + 1)
- self.assertEqual(f.tell(), self.LARGE + 2)
- self.assertEqual(f.seek(0, 2), self.LARGE + 1)
- self.assertEqual(f.seek(-1, 2), self.LARGE)
- self.assertEqual(f.read(2), b"x")
+ if sys.maxsize > 0x7FFFFFFF:
+ self.assertEqual(f.seek(self.LARGE), self.LARGE)
+ self.assertEqual(f.tell(), self.LARGE)
+ self.assertEqual(f.write(b"xxx"), 3)
+ self.assertEqual(f.tell(), self.LARGE + 3)
+ self.assertEqual(f.seek(-1, 1), self.LARGE + 2)
+ self.assertEqual(f.truncate(), self.LARGE + 2)
+ self.assertEqual(f.tell(), self.LARGE + 2)
+ self.assertEqual(f.seek(0, 2), self.LARGE + 2)
+ self.assertEqual(f.truncate(self.LARGE + 1), self.LARGE + 1)
+ self.assertEqual(f.tell(), self.LARGE + 2)
+ self.assertEqual(f.seek(0, 2), self.LARGE + 1)
+ self.assertEqual(f.seek(-1, 2), self.LARGE)
+ self.assertEqual(f.read(2), b"x")
def test_invalid_operations(self):
# Try writing on a file opened in read mode and vice-versa.
--
2.16.4