()
| 496 | |
| 497 | |
| 498 | def 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 | |
| 529 | def test_nullary_function(nullary_func_fixture): |
nothing calls this directly
no outgoing calls
no test coverage detected