]> granicus.if.org Git - python/commitdiff
Fixed test_strftime to be silent when called from autotest.
authorGuido van Rossum <guido@python.org>
Thu, 12 Dec 1996 19:07:19 +0000 (19:07 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 12 Dec 1996 19:07:19 +0000 (19:07 +0000)
Lib/test/output/test_strftime
Lib/test/test_strftime.py

index 1564499546dcbf44631b1b0f182d950db1398cf3..285407480a7eaef83c8d4b2a249c3fae33d0de5b 100644 (file)
@@ -1,5 +1 @@
 test_strftime
-Strftime test, platform: irix5, Python version: 1.4
-Does not appear to support '%k' format
-Does not appear to support '%s' format
-Does not appear to support '%3y' format
index 5e54b435923c42a659d72e2975aefe03c5c4b5c3..c27273517157c330077691c7ff6ee405dcc0b076 100755 (executable)
@@ -4,6 +4,11 @@
 
 import time, calendar, sys, string, os
 
+verbose = 0
+
+if __name__ == '__main__':
+    verbose = 1
+
 now = time.time()
 fp = os.popen('date')
 fromdate = string.strip(fp.readline())
@@ -35,14 +40,12 @@ expectations = (
     ('%b', calendar.month_abbr[now[1]], 'abbreviated month name'),
     ('%h', calendar.month_abbr[now[1]], 'abbreviated month name'),
     ('%c', time.asctime(now), 'asctime() format'),
-    ('%C', fromdate, 'date(1) format'),
     ('%D', '%02d/%02d/%02d' % (now[1], now[2], (now[0]%100)), 'mm/dd/yy'),
     ('%d', '%02d' % now[2], 'day of month as number (00-31)'),
     ('%e', '%2d' % now[2], 'day of month as number, blank padded ( 0-31)'),
     ('%H', '%02d' % now[3], 'hour (00-23)'),
     ('%I', '%02d' % clock12, 'hour (00-12)'),
     ('%j', '%03d' % now[7], 'julian day (001-366)'),
-    ('%k', '%2d' % now[3], 'hour, blank padded ( 0-23)'),
     ('%M', '%02d' % now[4], 'minute, (00-59)'),
     ('%m', '%02d' % now[1], 'month as number (01-12)'),
     ('%n', '\n', 'newline character'),
@@ -52,7 +55,6 @@ expectations = (
      '%I:%M:%S %p'),
     ('%t', '\t', 'tab character'),
     ('%S', '%02d' % now[5], 'seconds of current time (00-60)'),
-    ('%s', '%d' % nowsecs, 'seconds since the Epoch in UCT'),
     ('%T', '%02d:%02d:%02d' % (now[3], now[4], now[5]), '%H:%M:%S'),
     ('%X', '%02d:%02d:%02d' % (now[3], now[4], now[5]), '%H:%M:%S'),
     ('%U', '%02d' % (1+(wk1offset+now[7])/7),
@@ -65,12 +67,20 @@ expectations = (
     ('%y', '%02d' % (now[0]%100), 'year without century'),
     ('%Z', tz, 'time zone name'),
     ('%%', '%', 'single percent sign'),
+    )
+
+nonstandard_expectations = (
+    ('%C', fromdate, 'date(1) format'),
+    ('%k', '%2d' % now[3], 'hour, blank padded ( 0-23)'),
+    ('%s', '%d' % nowsecs, 'seconds since the Epoch in UCT'),
     ('%3y', '%03d' % (now[0]%100),
      'year without century rendered using fieldwidth'),
     )
 
-print "Strftime test, platform: %s, Python version: %s" % \
-      (sys.platform, string.split(sys.version)[0])
+if verbose:
+    print "Strftime test, platform: %s, Python version: %s" % \
+         (sys.platform, string.split(sys.version)[0])
+    expectations = expectations + nonstandard_expectations
 
 for e in expectations:
     result = time.strftime(e[0], now)