From 12fa82020d1953b2eb16957f39dd44c114b51a51 Mon Sep 17 00:00:00 2001 From: Robert Pack Date: Mon, 6 Nov 2023 00:58:37 +0100 Subject: [PATCH] fix: python field tests --- crates/deltalake-core/src/kernel/schema.rs | 2 +- python/tests/test_schema.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/deltalake-core/src/kernel/schema.rs b/crates/deltalake-core/src/kernel/schema.rs index 62b0496419..12391ca6e8 100644 --- a/crates/deltalake-core/src/kernel/schema.rs +++ b/crates/deltalake-core/src/kernel/schema.rs @@ -458,7 +458,7 @@ impl Display for PrimitiveType { PrimitiveType::Date => write!(f, "date"), PrimitiveType::Timestamp => write!(f, "timestamp"), PrimitiveType::Decimal(precision, scale) => { - write!(f, "decimal({}, {})", precision, scale) + write!(f, "decimal({},{})", precision, scale) } } } diff --git a/python/tests/test_schema.py b/python/tests/test_schema.py index e6d45441c0..f63df0e9fb 100644 --- a/python/tests/test_schema.py +++ b/python/tests/test_schema.py @@ -175,7 +175,10 @@ def test_delta_field(): assert field.name == name assert field.type == (PrimitiveType(ty) if isinstance(ty, str) else ty) assert field.nullable == nullable - assert field.metadata == (metadata or {}) + if metadata: + assert json.loads(field.metadata["x"]) == {"y": 3} + else: + assert field.metadata == {} # Field metadata doesn't roundtrip currently # See: https://github.com/apache/arrow-rs/issues/478