Skip to content

Commit 810e974

Browse files
hzmshclaude
andcommitted
test: cover float32 defaults read from JSON
Float defaults are now stored as float32 values, like Java, so the REST round-trip test's float default of 22.27 read back as 22.270000457763672. Use 22.25, which is exact in float32, and add a unit test for reading a float default from JSON. Generated-by: Claude Code (Claude Opus 5.5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 8c36a32 commit 810e974

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎tests/integration/test_rest_schema.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ def test_add_required_column(catalog: Catalog) -> None:
11001100
(BooleanType(), True, False),
11011101
(IntegerType(), 123, 456),
11021102
(LongType(), 123, 456),
1103-
(FloatType(), 19.25, 22.27),
1103+
(FloatType(), 19.25, 22.25), # exact in float32, so it reads back unchanged
11041104
(DoubleType(), 19.25, 22.27),
11051105
(DecimalType(10, 2), Decimal("19.25"), Decimal("22.27")),
11061106
(DecimalType(10, 2), Decimal("19.25"), Decimal("22.27")),

‎tests/test_conversions.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,11 @@ def test_json_single_deserialization_with_nano_precision(
633633
assert conversions.from_json(primitive_type, json_val) == expected
634634

635635

636+
def test_json_float_is_read_as_float32() -> None:
637+
assert conversions.from_json(FloatType(), 22.27) == 22.270000457763672
638+
assert conversions.from_json(DoubleType(), 22.27) == 22.27
639+
640+
636641
def test_unknown_type_conversions() -> None:
637642
"""Unknown values are always null, so they have no binary or partition representation."""
638643
unknown = UnknownType()

0 commit comments

Comments
 (0)