Skip to content

Commit 6cc20b9

Browse files
committed
add integration tests
1 parent d8a8bd6 commit 6cc20b9

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

tests/integration/test_writes.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
from pyiceberg.catalog import Catalog, Properties, Table, load_catalog
3535
from pyiceberg.catalog.sql import SqlCatalog
36-
from pyiceberg.exceptions import NamespaceAlreadyExistsError, NoSuchTableError
36+
from pyiceberg.exceptions import NamespaceAlreadyExistsError, NoSuchTableError, ServerError
3737
from pyiceberg.schema import Schema
3838
from pyiceberg.table import _dataframe_to_data_files
3939
from pyiceberg.types import (
@@ -676,3 +676,37 @@ def test_write_and_evolve(session_catalog: Catalog, format_version: int) -> None
676676
with txn.update_snapshot().fast_append() as snapshot_update:
677677
for data_file in _dataframe_to_data_files(table=tbl, df=pa_table_with_column, file_schema=txn.schema()):
678678
snapshot_update.append_data_file(data_file)
679+
680+
681+
@pytest.mark.integration
682+
@pytest.mark.parametrize("format_version", [1, 2])
683+
def test_table_properties_int_value(
684+
session_catalog: Catalog,
685+
arrow_table_with_null: pa.Table,
686+
format_version: str,
687+
) -> None:
688+
# table properties can be set to int, but still serialized to string
689+
property_with_int = {"property_name": 42}
690+
identifier = "default.test_table_properties_int_value"
691+
692+
tbl = _create_table(
693+
session_catalog, identifier, {"format-version": format_version, **property_with_int}, [arrow_table_with_null]
694+
)
695+
assert isinstance(tbl.properties["property_name"], str)
696+
697+
698+
@pytest.mark.integration
699+
@pytest.mark.parametrize("format_version", [1, 2])
700+
def test_table_properties_raise_for_none_value(
701+
session_catalog: Catalog,
702+
arrow_table_with_null: pa.Table,
703+
format_version: str,
704+
) -> None:
705+
property_with_none = {"property_name": None}
706+
identifier = "default.test_table_properties_raise_for_none_value"
707+
708+
with pytest.raises(ServerError) as exc_info:
709+
_ = _create_table(
710+
session_catalog, identifier, {"format-version": format_version, **property_with_none}, [arrow_table_with_null]
711+
)
712+
assert "NullPointerException: null value in entry: property_name=null" in str(exc_info.value)

0 commit comments

Comments
 (0)