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

Function test_string

python/pyarrow/tests/test_scalars.py:546–556  ·  view source on GitHub ↗
(value, ty, scalar_typ)

Source from the content-addressed store, hash-verified

544 (pa.string_view(), pa.StringViewScalar),
545])
546def test_string(value, ty, scalar_typ):
547 s = pa.scalar(value, type=ty)
548 assert isinstance(s, scalar_typ)
549 assert s.as_py() == value
550 assert s.as_py() != 'something'
551 assert repr(value) in repr(s)
552 assert str(s) == str(value)
553
554 buf = s.as_buffer()
555 assert isinstance(buf, pa.Buffer)
556 assert buf.to_pybytes() == value.encode()
557
558
559@pytest.mark.parametrize('value', [b'foo', b'bar', b'', None])

Callers

nothing calls this directly

Calls 3

as_pyMethod · 0.80
scalarMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected