mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Truncate st_?time before comparing it with ST_?TIME in the tests.
This commit is contained in:
parent
1083c248df
commit
4d394dfebb
3 changed files with 9 additions and 1 deletions
|
@ -1012,6 +1012,9 @@ objects. If newval is True, future calls to stat() return floats, if
|
||||||
it is False, future calls return ints. If newval is omitted, return
|
it is False, future calls return ints. If newval is omitted, return
|
||||||
the current setting.
|
the current setting.
|
||||||
|
|
||||||
|
For compatibility with older Python versions, accessing
|
||||||
|
\class{stat_result} as a tuple always returns integers.
|
||||||
|
|
||||||
\versionchanged[Python now returns float values by default. Applications
|
\versionchanged[Python now returns float values by default. Applications
|
||||||
which do not work correctly with floating point time stamps can use
|
which do not work correctly with floating point time stamps can use
|
||||||
this function to restore the old behaviour]{2.5}
|
this function to restore the old behaviour]{2.5}
|
||||||
|
|
|
@ -111,7 +111,11 @@ class StatAttributeTests(unittest.TestCase):
|
||||||
for name in dir(stat):
|
for name in dir(stat):
|
||||||
if name[:3] == 'ST_':
|
if name[:3] == 'ST_':
|
||||||
attr = name.lower()
|
attr = name.lower()
|
||||||
self.assertEquals(getattr(result, attr),
|
if name.endswith("TIME"):
|
||||||
|
def trunc(x): return int(x)
|
||||||
|
else:
|
||||||
|
def trunc(x): return x
|
||||||
|
self.assertEquals(trunc(getattr(result, attr)),
|
||||||
result[getattr(stat, name)])
|
result[getattr(stat, name)])
|
||||||
self.assert_(attr in members)
|
self.assert_(attr in members)
|
||||||
|
|
||||||
|
|
|
@ -151,6 +151,7 @@ C API
|
||||||
Tests
|
Tests
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
- In test_os, st_?time is now truncated before comparing it with ST_?TIME.
|
||||||
|
|
||||||
Mac
|
Mac
|
||||||
---
|
---
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue