]> granicus.if.org Git - python/commitdiff
#15802: Fix test logic in TestMaildir.test_create_tmp
authorPetri Lehtinen <petri@digip.org>
Sat, 1 Sep 2012 11:25:48 +0000 (14:25 +0300)
committerPetri Lehtinen <petri@digip.org>
Sat, 1 Sep 2012 11:25:48 +0000 (14:25 +0300)
Lib/test/test_mailbox.py
Misc/NEWS

index 5069aac77de061d4df32ace5e2ac4be66cb5bc54..b4a0fdfce5644a9f1fdc840821c15b06437d03a5 100644 (file)
@@ -660,13 +660,13 @@ class TestMaildir(TestMailbox, unittest.TestCase):
             self.assertTrue(match is not None, "Invalid file name: '%s'" % tail)
             groups = match.groups()
             if previous_groups is not None:
-                self.assertTrue(int(groups[0] >= previous_groups[0]),
+                self.assertGreaterEqual(int(groups[0]), int(previous_groups[0]),
                              "Non-monotonic seconds: '%s' before '%s'" %
                              (previous_groups[0], groups[0]))
-                self.assertTrue(int(groups[1] >= previous_groups[1]) or
-                             groups[0] != groups[1],
-                             "Non-monotonic milliseconds: '%s' before '%s'" %
-                             (previous_groups[1], groups[1]))
+                if int(groups[0]) == int(previous_groups[0]):
+                    self.assertGreaterEqual(int(groups[1]), int(previous_groups[1]),
+                                "Non-monotonic milliseconds: '%s' before '%s'" %
+                                (previous_groups[1], groups[1]))
                 self.assertTrue(int(groups[2]) == pid,
                              "Process ID mismatch: '%s' should be '%s'" %
                              (groups[2], pid))
index 13e8b00129ee1f754251065e44c13b0f65e3bb5a..0a35f0e52704474fbc13b2bb9c508e4d808a0fd3 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -352,6 +352,9 @@ Library
 Tests
 -----
 
+- Issue #15802: Fix test logic in TestMaildir.test_create_tmp. Patch
+  by Serhiy Storchaka.
+
 - Issue #15765: Extend a previous fix to Solaris and OpenBSD for quirky
   getcwd() behaviour (issue #9185) to NetBSD as well.