MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_strptime

Method test_strptime

Lib/test/test_time.py:322–337  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

320
321 @skip_if_buggy_ucrt_strfptime
322 def test_strptime(self):
323 # Should be able to go round-trip from strftime to strptime without
324 # raising an exception.
325 tt = time.gmtime(self.t)
326 for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I',
327 'j', 'm', 'M', 'p', 'S',
328 'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'):
329 format = '%' + directive
330 if directive == 'd':
331 format += ',%Y' # Avoid GH-70647.
332 strf_output = time.strftime(format, tt)
333 try:
334 time.strptime(strf_output, format)
335 except ValueError:
336 self.fail("conversion specifier %r failed with '%s' input." %
337 (format, strf_output))
338
339 def test_strptime_bytes(self):
340 # Make sure only strings are accepted as arguments to strptime.

Callers

nothing calls this directly

Calls 3

strftimeMethod · 0.45
strptimeMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected