Source code for syside.evaluation
1"""
2``syside.evaluation`` -- evaluate asserted constraints against concrete instances.
3
4This package checks whether the ``assert constraint { ... }`` constraints in a
5model actually hold for the instances that should satisfy them. It is built on
6:meth:`syside.Compiler.evaluate`, which defines exactly the fragment of
7constraints that can be checked; anything outside that fragment is reported
8:attr:`Verdict.UNDECIDABLE` rather than silently passed.
9
10The public surface is small:
11
12* :func:`check_model` -- check every constraint against every concrete instance.
13* :func:`check_instance` -- check the constraints applying to one instance.
14* :func:`evaluate_assertion` -- evaluate one assertion in an explicit scope.
15* :class:`ConstraintResult` / :class:`Verdict` -- the result type (``HOLDS``,
16 ``VIOLATED``, ``UNDECIDABLE``, or ``UNSUPPORTED``).
17"""
18
19from __future__ import annotations
20
21from syside.evaluation._constraints import (
22 ConstraintResult,
23 UnsupportedInstanceError,
24 Verdict,
25 check_instance,
26 check_model,
27 evaluate_assertion,
28)
29
30__all__ = [
31 "Verdict",
32 "ConstraintResult",
33 "UnsupportedInstanceError",
34 "evaluate_assertion",
35 "check_instance",
36 "check_model",
37]