]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Convert test failure from output-producing to self.fail().
authorGeorg Brandl <georg@python.org>
Mon, 8 Feb 2010 22:48:37 +0000 (22:48 +0000)
committerGeorg Brandl <georg@python.org>
Mon, 8 Feb 2010 22:48:37 +0000 (22:48 +0000)
Lib/test/test_strftime.py

index 5043bfaf329363830dcb3ac3e9dd50aa6f31201b..b26ebec93dc28295bc18b15c1980e70e85aadefd 100755 (executable)
@@ -118,16 +118,15 @@ class StrftimeTest(unittest.TestCase):
             try:
                 result = time.strftime(e[0], now)
             except ValueError, error:
-                print "Standard '%s' format gave error: %s" % (e[0], error)
-                continue
+                self.fail("strftime '%s' format gave error: %s" % (e[0], error))
             if re.match(escapestr(e[1], self.ampm), result):
                 continue
             if not result or result[0] == '%':
-                print "Does not support standard '%s' format (%s)" % \
-                       (e[0], e[2])
+                self.fail("strftime does not support standard '%s' format (%s)"
+                          % (e[0], e[2]))
             else:
-                print "Conflict for %s (%s):" % (e[0], e[2])
-                print "  Expected %s, but got %s" % (e[1], result)
+                self.fail("Conflict for %s (%s): expected %s, but got %s"
+                          % (e[0], e[2], e[1], result))
 
     def strftest2(self, now):
         nowsecs = str(long(now))[:-1]