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

Function __make_time_examples

tests/test_isoparser.py:425–467  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

appendMethod · 0.80
replaceMethod · 0.80

Tested by

no test coverage detected