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

Function test_bool

python/pyarrow/tests/test_scalars.py:210–232  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

208
209
210def test_bool():
211 false = pa.scalar(False)
212 true = pa.scalar(True)
213 null = pa.scalar(None, type=pa.bool_())
214
215 assert isinstance(false, pa.BooleanScalar)
216 assert isinstance(true, pa.BooleanScalar)
217 assert isinstance(null, pa.BooleanScalar)
218
219 assert repr(true) == "<pyarrow.BooleanScalar: True>"
220 assert str(true) == "True"
221 assert repr(false) == "<pyarrow.BooleanScalar: False>"
222 assert str(false) == "False"
223 assert repr(null) == "<pyarrow.BooleanScalar: None>"
224 assert str(null) == "None"
225
226 assert true.as_py() is True
227 assert false.as_py() is False
228 assert null.as_py() is None
229
230 assert bool(true) is True
231 assert bool(false) is False
232 assert bool(null) is False
233
234
235def test_numerics():

Callers

nothing calls this directly

Calls 2

as_pyMethod · 0.80
scalarMethod · 0.45

Tested by

no test coverage detected