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

Function test_expression_call_function

python/pyarrow/tests/test_compute.py:4286–4305  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4284
4285
4286def test_expression_call_function():
4287 field = pc.field("field")
4288
4289 # no options
4290 assert str(pc.hour(field)) == "hour(field)"
4291
4292 # default options
4293 assert str(pc.round(field)) == "round(field)"
4294 # specified options
4295 assert str(pc.round(field, ndigits=1)) == \
4296 "round(field, {ndigits=1, round_mode=HALF_TO_EVEN})"
4297
4298 # Will convert non-expression arguments if possible
4299 assert str(pc.add(field, 1)) == "add(field, 1)"
4300 assert str(pc.add(field, pa.scalar(1))) == "add(field, 1)"
4301
4302 # Invalid pc.scalar input gives original error message
4303 msg = "only other expressions allowed as arguments"
4304 with pytest.raises(TypeError, match=msg):
4305 pc.add(field, object)
4306
4307
4308def test_cast_table_raises():

Callers

nothing calls this directly

Calls 3

hourMethod · 0.80
fieldMethod · 0.45
scalarMethod · 0.45

Tested by

no test coverage detected