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

Function test_expression_construction

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

Source from the content-addressed store, hash-verified

4238
4239
4240def test_expression_construction():
4241 zero = pc.scalar(0)
4242 one = pc.scalar(1)
4243 true = pc.scalar(True)
4244 false = pc.scalar(False)
4245 string = pc.scalar("string")
4246 field = pc.field("field")
4247 nested_mixed_types = pc.field(b"a", 1, "b")
4248 nested_field = pc.field(("nested", "field"))
4249 nested_field2 = pc.field("nested", "field")
4250
4251 zero | one == string
4252 ~true == false
4253 for typ in ("bool", pa.bool_()):
4254 field.cast(typ) == true
4255
4256 field.isin([1, 2])
4257 nested_mixed_types.isin(["foo", "bar"])
4258 nested_field.isin(["foo", "bar"])
4259 nested_field2.isin(["foo", "bar"])
4260
4261 with pytest.raises(TypeError):
4262 field.isin(1)
4263
4264 with pytest.raises(pa.ArrowInvalid):
4265 field != object()
4266
4267
4268def test_expression_boolean_operators():

Callers

nothing calls this directly

Calls 3

scalarMethod · 0.45
fieldMethod · 0.45
castMethod · 0.45

Tested by

no test coverage detected