Skip to content

Commit 1d6a08c

Browse files
committed
add test for downcast schema
1 parent f565dc8 commit 1d6a08c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/table/test_init.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,20 @@ def test_schema_mismatch_additional_field(table_schema_simple: Schema) -> None:
10911091
_check_schema_compatible(table_schema_simple, other_schema)
10921092

10931093

1094+
def test_schema_downcast(table_schema_simple: Schema) -> None:
1095+
# large_string type is compatible with string type
1096+
other_schema = pa.schema((
1097+
pa.field("foo", pa.large_string(), nullable=True),
1098+
pa.field("bar", pa.int32(), nullable=False),
1099+
pa.field("baz", pa.bool_(), nullable=True),
1100+
))
1101+
1102+
try:
1103+
_check_schema_compatible(table_schema_simple, other_schema)
1104+
except Exception:
1105+
pytest.fail("Unexpected Exception raised when calling `_check_schema`")
1106+
1107+
10941108
def test_table_properties(example_table_metadata_v2: Dict[str, Any]) -> None:
10951109
# metadata properties are all strings
10961110
for k, v in example_table_metadata_v2["properties"].items():

0 commit comments

Comments
 (0)