From bb4a5f6871d8411236629cd514c01caa585c0c12 Mon Sep 17 00:00:00 2001 From: Martin Tournoij Date: Tue, 10 Oct 2023 17:17:23 +0100 Subject: [PATCH] Treat "Z" offset in datetime as case-insensitive This should be case-insensitive; e.g. this test failed: % toml-test ./tests/decoding_test.py -run valid/datetime/datetime FAIL valid/datetime/datetime Key "lower" is not "datetime" but "datetime-local": Expected: map[string]any{"type":"datetime", "value":"1987-07-05T17:45:00Z"} Your encoder: map[string]any{"type":"datetime-local", "value":"1987-07-05T17:45:00"} --- toml/decoder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toml/decoder.py b/toml/decoder.py index 6f23ec1..5bcc76f 100644 --- a/toml/decoder.py +++ b/toml/decoder.py @@ -544,7 +544,7 @@ def _load_date(val): microsecond = int(int(subsecondval) * (10 ** (6 - len(subsecondval)))) else: - tz = TomlTz(val[19:]) + tz = TomlTz(val[19:].upper()) except ValueError: tz = None if "-" not in val[1:]: