Skip to main content

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.

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 for the patterns worth following — above all, batch a module's runs into a single evaluate call.

Installation

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.

Tests that don't invoke the engine (building requests, converting data) need none of this; the integration-marked tests do.

Development

python -m venv venv
source venv/bin/activate
pip install -e ".[dev,docs]"

./pipelines/lint.sh   # Black + Ruff + MyPy
pytest                # unit tests (integration tests are deselected by default)
./pipelines/docs.sh   # build the Sphinx docs

Run the engine-backed tests explicitly once access is set up:

pytest -m integration

Documentation

Full reference and recipes: daitum-test.readthedocs.io.

Support

Questions and bug reports: github.com/daitumapi/daitum-test/issues.

Changelog

See CHANGELOG.md.

Licence

Apache 2.0 — see LICENSE.

Metadata

Release files for daitum-test 0.5.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for daitum-test 0.5.2
File Size Uploaded Provenance Actions
daitum_test-0.5.2.tar.gz 37.1 kB Without provenance Details for daitum_test-0.5.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for daitum-test 0.5.2
File Interpreter ABI Platform Actions
daitum_test-0.5.2-py3-none-any.whl Python 3 none any Details for daitum_test-0.5.2-py3-none-any.whl

Total release size: 67.0 kB

Release files / daitum_test-0.5.2.tar.gz

Download URL daitum_test-0.5.2.tar.gz
Size 37.1 kB
Tags Source
SHA-256 checksum
How to use checksums
057d469438ad811f1a159cbd855f8ad9be2a7aa98da0a08daa2bb67857019c20
BLAKE2b-256 checksum
How to use checksums
5225c7a187b68856d384244812dd4df3a92b3e3b97a583ab9d6f9da1e55e4ba4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.18

Release files / daitum_test-0.5.2-py3-none-any.whl

Download URL daitum_test-0.5.2-py3-none-any.whl
Size 29.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
158e8de678bd2dbf446363bb887d616979235095e5fd518d9fc5beb34a60e253
BLAKE2b-256 checksum
How to use checksums
cef2412c4c80f7170792337f08379020c7c0060ad48c75ca89265f1790c813f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.18

Security for daitum-test 0.5.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page