mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
Backout f8409b3d6449: the PEP 410 is not accepted yet
This commit is contained in:
parent
72476eae5f
commit
4195b5caea
9 changed files with 175 additions and 815 deletions
|
@ -2,7 +2,6 @@
|
|||
# does add tests for a few functions which have been determined to be more
|
||||
# portable than they had been thought to be.
|
||||
|
||||
import decimal
|
||||
import os
|
||||
import errno
|
||||
import unittest
|
||||
|
@ -239,36 +238,6 @@ class StatAttributeTests(unittest.TestCase):
|
|||
warnings.simplefilter("ignore", DeprecationWarning)
|
||||
self.check_stat_attributes(fname)
|
||||
|
||||
def test_stat_timestamp(self):
|
||||
# test deprecation
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("error", DeprecationWarning)
|
||||
self.assertRaises(DeprecationWarning, os.stat_float_times, False)
|
||||
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore", DeprecationWarning)
|
||||
old_value = os.stat_float_times()
|
||||
try:
|
||||
# test invalid timestamp types
|
||||
self.assertRaises(ValueError, os.stat, self.fname,
|
||||
timestamp="abc")
|
||||
self.assertRaises(ValueError, os.stat, self.fname,
|
||||
timestamp=decimal.Context)
|
||||
|
||||
for float_times in (False, True):
|
||||
os.stat_float_times(float_times)
|
||||
t = os.stat(self.fname).st_mtime
|
||||
if float_times:
|
||||
self.assertIsInstance(t, float)
|
||||
else:
|
||||
self.assertIsInstance(t, int)
|
||||
|
||||
for type in (int, float, decimal.Decimal):
|
||||
t = os.stat(self.fname, timestamp=type).st_mtime
|
||||
self.assertIsInstance(t, type)
|
||||
finally:
|
||||
os.stat_float_times(old_value)
|
||||
|
||||
def test_statvfs_attributes(self):
|
||||
if not hasattr(os, "statvfs"):
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue