Skip to content

Commit 9fe9cff

Browse files
committed
rewrite validator
1 parent 5616ef0 commit 9fe9cff

File tree

2 files changed

+4
-34
lines changed

2 files changed

+4
-34
lines changed

pyiceberg/table/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,10 @@ class SetLocationUpdate(TableUpdate):
474474
class SetPropertiesUpdate(TableUpdate):
475475
action: TableUpdateAction = TableUpdateAction.set_properties
476476
updates: Properties
477-
# validators
478-
transform_properties_dict_value_to_str = field_validator('updates', mode='before')(transform_dict_value_to_str)
477+
478+
@field_validator('updates', mode='before')
479+
def transform_properties_dict_value_to_str(cls, properties: Properties) -> Dict[str, str]:
480+
return transform_dict_value_to_str(properties)
479481

480482

481483
class RemovePropertiesUpdate(TableUpdate):

tests/integration/test_reads.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -169,38 +169,6 @@ def test_table_properties_error(catalog: Catalog) -> None:
169169
assert "Cannot pass both properties and kwargs" in str(e.value)
170170

171171

172-
@pytest.mark.integration
173-
@pytest.mark.parametrize('catalog', [pytest.lazy_fixture('catalog_hive'), pytest.lazy_fixture('catalog_rest')])
174-
def test_table_properties_dict(catalog: Catalog) -> None:
175-
table = create_table(catalog)
176-
177-
assert table.properties == DEFAULT_PROPERTIES
178-
179-
with table.transaction() as transaction:
180-
transaction.set_properties({"abc": "🤪"})
181-
assert table.properties == dict({"abc": "🤪"}, **DEFAULT_PROPERTIES)
182-
183-
with table.transaction() as transaction:
184-
transaction.remove_properties("abc")
185-
assert table.properties == DEFAULT_PROPERTIES
186-
187-
table = table.transaction().set_properties({"abc": "def"}).commit_transaction()
188-
assert table.properties == dict({"abc": "def"}, **DEFAULT_PROPERTIES)
189-
190-
table = table.transaction().remove_properties("abc").commit_transaction()
191-
assert table.properties == DEFAULT_PROPERTIES
192-
193-
194-
@pytest.mark.integration
195-
@pytest.mark.parametrize('catalog', [pytest.lazy_fixture('catalog_hive'), pytest.lazy_fixture('catalog_rest')])
196-
def test_table_properties_error(catalog: Catalog) -> None:
197-
table = create_table(catalog)
198-
properties = {"abc": "def"}
199-
with pytest.raises(ValueError) as e:
200-
table.transaction().set_properties(properties, abc="def").commit_transaction()
201-
assert "Cannot pass both properties and kwargs" in str(e.value)
202-
203-
204172
@pytest.mark.integration
205173
@pytest.mark.parametrize('catalog', [pytest.lazy_fixture('catalog_hive'), pytest.lazy_fixture('catalog_rest')])
206174
def test_pyarrow_nan(catalog: Catalog) -> None:

0 commit comments

Comments
 (0)