]> granicus.if.org Git - python/commitdiff
Truncate st_?time before comparing it with ST_?TIME in the tests.
authorMartin v. Löwis <martin@v.loewis.de>
Sun, 23 Jan 2005 09:19:22 +0000 (09:19 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sun, 23 Jan 2005 09:19:22 +0000 (09:19 +0000)
Doc/lib/libos.tex
Lib/test/test_os.py
Misc/NEWS

index 60657255afb4d85d46e075d6940aa4c7f6117034..669cc8f816162d34c387bcb801d1ac5622eb9cc1 100644 (file)
@@ -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
 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
 which do not work correctly with floating point time stamps can use
 this function to restore the old behaviour]{2.5}
index 25fad18a2aa3041e9b40ac5c7f3c3e92aa852527..472d13fd092a1ce285d2bdd0fb72a7fbcbb28ee3 100644 (file)
@@ -111,7 +111,11 @@ class StatAttributeTests(unittest.TestCase):
         for name in dir(stat):
             if name[:3] == 'ST_':
                 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)])
                 self.assert_(attr in members)
 
index ec8570b50457b6894db345ee9767c39ded916e57..cad22cd561dbfb7ae903e8ef5c03310847de61a9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -151,6 +151,7 @@ C API
 Tests
 -----
 
+- In test_os, st_?time is now truncated before comparing it with ST_?TIME.
 
 Mac
 ---