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

Function test_invalid_expression_ser_des

python/pyarrow/tests/test_substrait.py:1010–1027  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1008
1009
1010def test_invalid_expression_ser_des():
1011 schema = pa.schema([
1012 pa.field("x", pa.int32()),
1013 pa.field("y", pa.int32())
1014 ])
1015 expr = pc.equal(pc.field("x"), 7)
1016 bad_expr = pc.equal(pc.field("z"), 7)
1017 # Invalid number of names
1018 with pytest.raises(ValueError) as excinfo:
1019 pa.substrait.serialize_expressions([expr], [], schema)
1020 assert 'need to have the same length' in str(excinfo.value)
1021 with pytest.raises(ValueError) as excinfo:
1022 pa.substrait.serialize_expressions([expr], ["foo", "bar"], schema)
1023 assert 'need to have the same length' in str(excinfo.value)
1024 # Expression doesn't match schema
1025 with pytest.raises(ValueError) as excinfo:
1026 pa.substrait.serialize_expressions([bad_expr], ["expr"], schema)
1027 assert 'No match for FieldRef' in str(excinfo.value)
1028
1029
1030def test_serializing_multiple_expressions():

Callers

nothing calls this directly

Calls 2

schemaMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected