MCPcopy Create free account
hub / github.com/dateutil/dateutil / __make_time_examples

Function __make_time_examples

tests/test_isoparser.py:412–454  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

410###
411# Test parse_isotime
412def __make_time_examples():
413 outputs = []
414
415 # HH
416 time_h = [time(0), time(8), time(22)]
417 time_h_fmts = ['%H']
418
419 outputs.append(it.product(time_h, time_h_fmts))
420
421 # HHMM / HH:MM
422 time_hm = [time(0, 0), time(0, 30), time(8, 47), time(16, 1)]
423 time_hm_fmts = ['%H%M', '%H:%M']
424
425 outputs.append(it.product(time_hm, time_hm_fmts))
426
427 # HHMMSS / HH:MM:SS
428 time_hms = [time(0, 0, 0), time(0, 15, 30),
429 time(8, 2, 16), time(12, 0), time(16, 2), time(20, 45)]
430
431 time_hms_fmts = ['%H%M%S', '%H:%M:%S']
432
433 outputs.append(it.product(time_hms, time_hms_fmts))
434
435 # HHMMSS.ffffff / HH:MM:SS.ffffff
436 time_hmsu = [time(0, 0, 0, 0), time(4, 15, 3, 247993),
437 time(14, 21, 59, 948730),
438 time(23, 59, 59, 999999)]
439
440 time_hmsu_fmts = ['%H%M%S.%f', '%H:%M:%S.%f']
441
442 outputs.append(it.product(time_hmsu, time_hmsu_fmts))
443
444 outputs = list(map(list, outputs))
445
446 # Time zones
447 ex_naive = list(it.chain.from_iterable(x[0:2] for x in outputs))
448 o = it.product(ex_naive, TZOFFSETS) # ((time, fmt), (tzinfo, offsetstr))
449 o = ((t.replace(tzinfo=tzi), fmt + off_str)
450 for (t, fmt), (tzi, off_str) in o)
451
452 outputs.append(o)
453
454 return list(it.chain.from_iterable(outputs))
455
456
457@pytest.mark.parametrize('time_val,time_fmt', __make_time_examples())

Callers

nothing calls this directly

Calls 2

appendMethod · 0.80
replaceMethod · 0.45

Tested by

no test coverage detected