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

Function test_function_doc_validation

python/pyarrow/tests/test_udf.py:498–526  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

496
497
498def test_function_doc_validation():
499 # validate arity
500 in_types = {"scalar": pa.int64()}
501 out_type = pa.int64()
502
503 # doc with no summary
504 func_doc = {
505 "description": "desc"
506 }
507
508 def add_const(ctx, scalar):
509 return pc.call_function("add", [scalar, 1])
510
511 with pytest.raises(ValueError,
512 match="Function doc must contain a summary"):
513 pc.register_scalar_function(add_const, "test_no_summary",
514 func_doc, in_types,
515 out_type)
516
517 # doc with no description
518 func_doc = {
519 "summary": "test summary"
520 }
521
522 with pytest.raises(ValueError,
523 match="Function doc must contain a description"):
524 pc.register_scalar_function(add_const, "test_no_desc",
525 func_doc, in_types,
526 out_type)
527
528
529def test_nullary_function(nullary_func_fixture):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected