MCPcopy Create free account
hub / github.com/apache/arrow / test_table_cast_invalid

Function test_table_cast_invalid

python/pyarrow/tests/test_table.py:3500–3509  ·  view source on GitHub ↗
(cls)

Source from the content-addressed store, hash-verified

3498 ]
3499)
3500def test_table_cast_invalid(cls):
3501 # Casting a nullable field to non-nullable should be invalid!
3502 table = cls.from_pydict({'a': [None, 1], 'b': [None, True]})
3503 new_schema = pa.schema([pa.field("a", "int64", nullable=True),
3504 pa.field("b", "bool", nullable=False)])
3505 with pytest.raises(ValueError):
3506 table.cast(new_schema)
3507
3508 table = cls.from_pydict({'a': [None, 1], 'b': [False, True]})
3509 assert table.cast(new_schema).schema == new_schema
3510
3511
3512@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 3

schemaMethod · 0.45
fieldMethod · 0.45
castMethod · 0.45

Tested by

no test coverage detected