summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_os.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r--Lib/test/test_os.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index e129bef..ce6bd91 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -265,10 +265,13 @@ class StatAttributeTests(unittest.TestCase):
def test_stat_result_pickle(self):
result = os.stat(self.fname)
- p = pickle.dumps(result)
- self.assertIn(b'\x03cos\nstat_result\n', p)
- unpickled = pickle.loads(p)
- self.assertEqual(result, unpickled)
+ for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+ p = pickle.dumps(result, proto)
+ self.assertIn(b'stat_result', p)
+ if proto < 4:
+ self.assertIn(b'cos\nstat_result\n', p)
+ unpickled = pickle.loads(p)
+ self.assertEqual(result, unpickled)
@unittest.skipUnless(hasattr(os, 'statvfs'), 'test needs os.statvfs()')
def test_statvfs_attributes(self):
@@ -324,10 +327,13 @@ class StatAttributeTests(unittest.TestCase):
if e.errno == errno.ENOSYS:
self.skipTest('os.statvfs() failed with ENOSYS')
- p = pickle.dumps(result)
- self.assertIn(b'\x03cos\nstatvfs_result\n', p)
- unpickled = pickle.loads(p)
- self.assertEqual(result, unpickled)
+ for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+ p = pickle.dumps(result, proto)
+ self.assertIn(b'statvfs_result', p)
+ if proto < 4:
+ self.assertIn(b'cos\nstatvfs_result\n', p)
+ unpickled = pickle.loads(p)
+ self.assertEqual(result, unpickled)
def test_utime_dir(self):
delta = 1000000