Register a nullary scalar function with an ephemeral Python function. This stresses that the Python function object is properly kept alive by the registered function.
()
| 224 | |
| 225 | @pytest.fixture(scope="session") |
| 226 | def ephemeral_nullary_func_fixture(): |
| 227 | """ |
| 228 | Register a nullary scalar function with an ephemeral Python function. |
| 229 | This stresses that the Python function object is properly kept alive by the |
| 230 | registered function. |
| 231 | """ |
| 232 | def nullary_func(context): |
| 233 | return pa.array([42] * context.batch_length, type=pa.int64(), |
| 234 | memory_pool=context.memory_pool) |
| 235 | |
| 236 | func_doc = { |
| 237 | "summary": "random function", |
| 238 | "description": "generates a random value" |
| 239 | } |
| 240 | func_name = "test_ephemeral_nullary_func" |
| 241 | pc.register_scalar_function(nullary_func, |
| 242 | func_name, |
| 243 | func_doc, |
| 244 | {}, |
| 245 | pa.int64()) |
| 246 | |
| 247 | return func_name |
| 248 | |
| 249 | |
| 250 | @pytest.fixture(scope="session") |
nothing calls this directly
no outgoing calls
no test coverage detected