Metadata-Version: 2.4
Name: daitum-test
Version: 0.5.3
Summary: Test Daitum models from Python
Author-email: Daitum <developers@daitum.com>
License-Expression: Apache-2.0
Project-URL: Homepage, https://daitum.com
Project-URL: Documentation, https://daitum-test.readthedocs.io
Project-URL: Repository, https://github.com/daitumapi/daitum-test
Project-URL: Issues, https://github.com/daitumapi/daitum-test/issues
Project-URL: Changelog, https://github.com/daitumapi/daitum-test/blob/main/CHANGELOG.md
Keywords: daitum,testing,optimisation,model,pytest
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Testing
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: black==26.1.0; extra == "dev"
Requires-Dist: ruff==0.14.13; extra == "dev"
Requires-Dist: mypy==1.19.1; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: types-setuptools; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx>=7.0; extra == "docs"
Requires-Dist: sphinx-autodoc-typehints>=1.25; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=3.0; extra == "docs"
Dynamic: license-file

# daitum-test

Test Daitum models from Python. Load a model, feed it data, run it, and make plain
assertions about the results — tables, named values, and diagnostics — without the platform.

## What it's for

Write fast, local, repeatable tests for your models: unit-test a formula against crafted
inputs, check an optimisation stays within budget, assert an output table has no error cells,
or compare several scenarios in one run. It replaces slow platform round-trips and
hand-reimplemented formulas with assertions against what the model actually computes.

```python
from daitum_test import Evaluator, Model, Run

model = Model.from_archive("MyModel.zip")
evaluator = Evaluator()

result = evaluator.evaluate(model, runs=[
    Run(id="high-demand", scenario="Initial", mode="OPTIMISER",
        tables={"Items": "fixtures/items_high_demand.csv"},  # cells typed from the model
        named_values={"Budget": 50_000}),
])

run = result["high-demand"]
assert run.errors == []
assert run.named_value("TotalCost") <= 50_000
assert run.table("Output").row_count >= 1
assert run.table("Output").error_cells() == []
```

Load a model from an exported zip (`Model.from_archive`), a model directory
(`Model.from_directory`), or an in-process definition (`Model.from_definition` — daitum-core
builders work directly). Feed data as CSV files or inline rows; cells are typed automatically
from the model's own field definitions. A pytest plugin provides a ready-made `evaluator`
fixture. See the [cookbook](https://daitum-test.readthedocs.io/en/latest/cookbook.html) for the
patterns worth following — above all, batch a module's runs into a single `evaluate` call.

## Installation

```bash
pip install daitum-test
```

The package has no runtime dependencies beyond the Python standard library.

## Requirements

Evaluation runs against the Daitum model engine, which is distributed separately from this
package and requires access to obtain.

1. Request access and download the engine (contact Daitum).
2. Point the wrapper at it with the `EVALUATOR_JAR` environment variable.
3. Have a supported Java runtime available (Java 25+). The wrapper finds it automatically, or
   set `EVALUATOR_JAVA` / `JAVA_HOME` to choose one.

## Documentation

Full reference and recipes: [daitum-test.readthedocs.io](https://daitum-test.readthedocs.io).

## Support

Questions and bug reports: [github.com/daitumapi/daitum-test/issues](https://github.com/daitumapi/daitum-test/issues).

## Changelog

See [CHANGELOG.md](https://github.com/daitumapi/daitum-test/blob/main/CHANGELOG.md).

## Licence

Apache 2.0 — see [LICENSE](https://github.com/daitumapi/daitum-test/blob/main/LICENSE).
