Skip to content

Commit 9592ba9

Browse files
fix: preserve empty boolean property fallback
Keep the behavior introduced on main while resolving the property helper conflict.
1 parent 2b9b074 commit 9592ba9

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

‎pyiceberg/utils/properties.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def property_as_bool(
5858
property_name: str,
5959
default: bool,
6060
) -> bool:
61-
if (value := properties.get(property_name)) is not None:
61+
if (value := properties.get(property_name)) not in (None, ""):
6262
try:
6363
return strtobool(str(value))
6464
except ValueError as e:

‎tests/utils/test_properties.py‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,7 @@ def test_property_as_float_with_empty_string() -> None:
118118

119119

120120
def test_property_as_bool_with_empty_string() -> None:
121-
properties = {
122-
"some_bool_prop": "",
123-
}
124-
125-
with pytest.raises(ValueError) as exc:
126-
property_as_bool(properties, "some_bool_prop", default=True)
127-
assert "Could not parse table property some_bool_prop to a boolean: " in str(exc.value)
121+
assert property_as_bool({"some_bool_prop": ""}, "some_bool_prop", default=True) is True
128122

129123

130124
def test_get_first_property_value() -> None:

0 commit comments

Comments
 (0)