(self, now)
| 139 | % (e[0], e[2], e[1], result)) |
| 140 | |
| 141 | def strftest2(self, now): |
| 142 | nowsecs = str(int(now))[:-1] |
| 143 | now = self.now |
| 144 | |
| 145 | nonstandard_expectations = ( |
| 146 | # These are standard but don't have predictable output |
| 147 | ('%c', fixasctime(time.asctime(now)), 'near-asctime() format'), |
| 148 | ('%x', '%02d/%02d/%02d' % (now[1], now[2], (now[0]%100)), |
| 149 | '%m/%d/%y %H:%M:%S'), |
| 150 | ('%Z', '%s' % self.tz, 'time zone name'), |
| 151 | |
| 152 | # These are some platform specific extensions |
| 153 | ('%D', '%02d/%02d/%02d' % (now[1], now[2], (now[0]%100)), 'mm/dd/yy'), |
| 154 | ('%e', '%2d' % now[2], 'day of month as number, blank padded ( 0-31)'), |
| 155 | ('%h', calendar.month_abbr[now[1]], 'abbreviated month name'), |
| 156 | ('%k', '%2d' % now[3], 'hour, blank padded ( 0-23)'), |
| 157 | ('%n', '\n', 'newline character'), |
| 158 | ('%r', '%02d:%02d:%02d %s' % (self.clock12, now[4], now[5], self.ampm), |
| 159 | '%I:%M:%S %p'), |
| 160 | ('%R', '%02d:%02d' % (now[3], now[4]), '%H:%M'), |
| 161 | ('%s', nowsecs, 'seconds since the Epoch in UCT'), |
| 162 | ('%t', '\t', 'tab character'), |
| 163 | ('%T', '%02d:%02d:%02d' % (now[3], now[4], now[5]), '%H:%M:%S'), |
| 164 | ('%3y', '%03d' % (now[0]%100), |
| 165 | 'year without century rendered using fieldwidth'), |
| 166 | ) |
| 167 | |
| 168 | |
| 169 | for e in nonstandard_expectations: |
| 170 | try: |
| 171 | result = time.strftime(e[0], now) |
| 172 | except ValueError as result: |
| 173 | msg = "Error for nonstandard '%s' format (%s): %s" % \ |
| 174 | (e[0], e[2], str(result)) |
| 175 | if support.verbose: |
| 176 | print(msg) |
| 177 | continue |
| 178 | if re.match(escapestr(e[1], self.ampm), result): |
| 179 | if support.verbose: |
| 180 | print("Supports nonstandard '%s' format (%s)" % (e[0], e[2])) |
| 181 | elif not result or result[0] == '%': |
| 182 | if support.verbose: |
| 183 | print("Does not appear to support '%s' format (%s)" % \ |
| 184 | (e[0], e[2])) |
| 185 | else: |
| 186 | if support.verbose: |
| 187 | print("Conflict for nonstandard '%s' format (%s):" % \ |
| 188 | (e[0], e[2])) |
| 189 | print(" Expected %s, but got %s" % (e[1], result)) |
| 190 | |
| 191 | |
| 192 | class Y1900Tests(unittest.TestCase): |
no test coverage detected