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

Method test_safe_unsafe_casts

python/pyarrow/tests/test_pandas.py:3293–3309  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3291 pa_arr.equals(expected)
3292
3293 def test_safe_unsafe_casts(self):
3294 # ARROW-2799
3295 df = pd.DataFrame({
3296 'A': list('abc'),
3297 'B': np.linspace(0, 1, 3)
3298 })
3299
3300 schema = pa.schema([
3301 pa.field('A', pa.string()),
3302 pa.field('B', pa.int32())
3303 ])
3304
3305 with pytest.raises(ValueError):
3306 pa.Table.from_pandas(df, schema=schema)
3307
3308 table = pa.Table.from_pandas(df, schema=schema, safe=False)
3309 assert table.column('B').type == pa.int32()
3310
3311 def test_error_sparse(self):
3312 # ARROW-2818

Callers

nothing calls this directly

Calls 5

listFunction · 0.85
schemaMethod · 0.45
fieldMethod · 0.45
stringMethod · 0.45
columnMethod · 0.45

Tested by

no test coverage detected