diff --git a/core/data/tests/test_custom_serialize_deserialize_functions/output.py b/core/data/tests/test_custom_serialize_deserialize_functions/output.py index 71af1dad..6add1753 100644 --- a/core/data/tests/test_custom_serialize_deserialize_functions/output.py +++ b/core/data/tests/test_custom_serialize_deserialize_functions/output.py @@ -25,6 +25,11 @@ def parse_rfc3339(date_str: str) -> datetime: "%Y-%m-%dT%H:%M:%SZ", "%Y-%m-%dT%H:%M:%S.%fZ" ] + + # %f accepts at most 6 fractional digits, but Rust can emit up to 9 (nanoseconds) + head, dot, fraction = date_str.partition(".") + if dot and fraction.endswith("Z"): + date_str = f"{head}.{fraction[:-1][:6]}Z" for fmt in date_formats: try: diff --git a/core/data/tests/test_serde_iso8601/output.py b/core/data/tests/test_serde_iso8601/output.py index 246d940c..3a888a70 100644 --- a/core/data/tests/test_serde_iso8601/output.py +++ b/core/data/tests/test_serde_iso8601/output.py @@ -13,6 +13,11 @@ def parse_rfc3339(date_str: str) -> datetime: "%Y-%m-%dT%H:%M:%SZ", "%Y-%m-%dT%H:%M:%S.%fZ" ] + + # %f accepts at most 6 fractional digits, but Rust can emit up to 9 (nanoseconds) + head, dot, fraction = date_str.partition(".") + if dot and fraction.endswith("Z"): + date_str = f"{head}.{fraction[:-1][:6]}Z" for fmt in date_formats: try: diff --git a/core/src/language/python.rs b/core/src/language/python.rs index b96d8d6d..0c2f672f 100644 --- a/core/src/language/python.rs +++ b/core/src/language/python.rs @@ -798,6 +798,11 @@ fn json_translation_for_type(python_type: &str) -> Option