test_all¶
Classes¶
A Context represents an immutable argument to a callable model. |
|
Generic base class for Callable Models, with a default implementation for __deps__. |
|
Mimics ModelEvaluationContext for unit testing. |
|
Module Contents¶
- class test_all.TestCeleryApp¶
- test_defaults()¶
- test_get_app_creates_celery(MockCelery)¶
- test_get_app_caches(MockCelery)¶
- test_get_app_applies_task_routes(MockCelery)¶
- test_get_app_applies_worker_concurrency(MockCelery)¶
- class test_all._DummyContext(/, **data: Any)¶
Bases:
ccflow.NullContextA Context represents an immutable argument to a callable model.
All contexts should derive from this base class. A context is also a type of result, as a CallableModel could be responsible for generating a context that is an input into another CallableModel.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class test_all._DummyModel(/, **data: Any)¶
Bases:
ccflow.CallableModelGeneric base class for Callable Models, with a default implementation for __deps__.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- __call__(context: _DummyContext) ccflow_celery.GenericResult¶
This method produces the result for the given context.
Instead of passing the context, one can pass an object that pydantic will try to validate as the context. Additionally, if kwargs are passed instead of the context, it will use these to construct the context.
- class test_all.TestExecuteModelTask¶
- test_basic_execution()¶
Round-trip: serialise a simple model+context, execute in the task.
- test_result_has_model_dump()¶
If the model returns a ResultBase, execute_model_task returns model_dump().
- test_bad_class_path_raises()¶
- class test_all._FakeEvalContext(model, context, fn='__call__')¶
Mimics ModelEvaluationContext for unit testing.
- model¶
- context¶
- fn = '__call__'¶
- options¶
- __call__()¶
- class test_all.TestCeleryEvaluator¶
- _make_evaluator()¶
- test_remote_dispatch(MockCelery)¶
- test_non_call_fn_runs_locally()¶
When fn != ‘__call__’, CeleryEvaluator executes locally.
- test_result_reconstruction_with_result_type(MockCelery)¶
When model has result_type, evaluator reconstructs from it.
- test_celery_app_caching(MockCelery)¶
- class test_all.TestCeleryGraphEvaluator¶
- _make_evaluator()¶
- test_reentrant_calls_locally()¶
When _is_evaluating is True, graph evaluator executes context() directly.
- test_single_node_graph(MockCelery, mock_get_dep)¶
Graph with one node dispatches via apply_async directly (no group).
- test_parallel_nodes_use_group(MockCelery, mock_group, mock_get_dep)¶
Multiple independent nodes at the same level use Celery group.
- test_is_evaluating_reset_on_exception(MockCelery, mock_get_dep)¶
_is_evaluating is reset even when graph processing raises.