MCPcopy Create free account
hub / github.com/coooodeer/parse-rust / test_datetime_with_various_subsecond_precision

Function test_datetime_with_various_subsecond_precision

tests/test_parse.py:386–400  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

384
385
386def test_datetime_with_various_subsecond_precision():
387 r = parse.parse("{dt:%Y-%m-%d %H:%M:%S.%f}", "2023-11-21 13:23:27.123456")
388 assert r.named["dt"] == datetime(2023, 11, 21, 13, 23, 27, 123456)
389
390 r = parse.parse("{dt:%Y-%m-%d %H:%M:%S.%f}", "2023-11-21 13:23:27.12345")
391 assert r.named["dt"] == datetime(2023, 11, 21, 13, 23, 27, 123450)
392
393 r = parse.parse("{dt:%Y-%m-%d %H:%M:%S.%f}", "2023-11-21 13:23:27.1234")
394 assert r.named["dt"] == datetime(2023, 11, 21, 13, 23, 27, 123400)
395
396 r = parse.parse("{dt:%Y-%m-%d %H:%M:%S.%f}", "2023-11-21 13:23:27.123")
397 assert r.named["dt"] == datetime(2023, 11, 21, 13, 23, 27, 123000)
398
399 r = parse.parse("{dt:%Y-%m-%d %H:%M:%S.%f}", "2023-11-21 13:23:27.0")
400 assert r.named["dt"] == datetime(2023, 11, 21, 13, 23, 27, 0)
401
402
403@pytest.mark.skipif(

Callers

nothing calls this directly

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected