STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_model_spec Namespace Reference

Functions

dict[str, Param] _pipe (**Param overrides)
None test_component_schemas_are_data ()
None test_a_shipped_spec_describes_itself_completely ()
None test_defaults_are_filled_and_tagged_as_defaults ()
None test_a_missing_required_parameter_is_named ()
None test_all_problems_are_reported_at_once ()
None test_a_wrong_dimension_is_caught_before_any_physics ()
None test_bounds_are_enforced_in_canonical_units ()
None test_an_unknown_component_type_lists_what_exists ()
None test_a_model_only_needs_its_own_parameters ()
None test_an_unknown_model_is_rejected ()
None test_a_spec_cannot_reference_a_model_it_does_not_declare ()
None test_duplicate_parameters_are_rejected ()
None test_an_instance_round_trips_through_json_identically ()
None test_authored_units_survive_the_round_trip ()
None test_round_trip_preserves_provenance_and_references ()
None test_a_component_type_can_be_declared_from_outside (Path tmp_path)
None test_a_component_type_can_be_registered_in_code ()
None test_unconnected_fluid_ports_are_reported ()
None test_signal_ports_are_not_expected_to_be_plumbed ()

Variables

 MANUF = Provenance.MANUFACTURER

Detailed Description

Component declarations: validation, fidelity models, and round-tripping.

Two exit criteria of Phase 02 live here -- a configuration round-trips
identically, and a component's schema is data rather than code. The rest is
validation: every check that can be made without solving anything, made at load
time, with all failures reported together.

Function Documentation

◆ _pipe()

◆ test_a_component_type_can_be_declared_from_outside()

None test_model_spec.test_a_component_type_can_be_declared_from_outside ( Path tmp_path)
A project adds a component type without editing this package.

Definition at line 244 of file test_model_spec.py.

◆ test_a_component_type_can_be_registered_in_code()

None test_model_spec.test_a_component_type_can_be_registered_in_code ( )

Definition at line 276 of file test_model_spec.py.

◆ test_a_missing_required_parameter_is_named()

None test_model_spec.test_a_missing_required_parameter_is_named ( )

Definition at line 90 of file test_model_spec.py.

◆ test_a_model_only_needs_its_own_parameters()

None test_model_spec.test_a_model_only_needs_its_own_parameters ( )
An orifice using ISO 5167 is not asked for a discharge coefficient.

Cd belongs to the 'cd' model; the 'iso5167' model computes it from geometry
and Reynolds number. Asking for it anyway would force a value that is then
silently ignored -- the worst kind of parameter.

Definition at line 148 of file test_model_spec.py.

◆ test_a_shipped_spec_describes_itself_completely()

None test_model_spec.test_a_shipped_spec_describes_itself_completely ( )
Enough for a UI to render an editor without knowing what a pipe is.

Definition at line 66 of file test_model_spec.py.

◆ test_a_spec_cannot_reference_a_model_it_does_not_declare()

None test_model_spec.test_a_spec_cannot_reference_a_model_it_does_not_declare ( )

Definition at line 171 of file test_model_spec.py.

◆ test_a_wrong_dimension_is_caught_before_any_physics()

None test_model_spec.test_a_wrong_dimension_is_caught_before_any_physics ( )

Definition at line 114 of file test_model_spec.py.

References _pipe().

◆ test_all_problems_are_reported_at_once()

None test_model_spec.test_all_problems_are_reported_at_once ( )
Six errors at a time beats six edit-run cycles.

Definition at line 97 of file test_model_spec.py.

◆ test_an_instance_round_trips_through_json_identically()

None test_model_spec.test_an_instance_round_trips_through_json_identically ( )
Phase 02's round-trip criterion.

Through JSON specifically -- an in-memory copy would not catch a field that
serialises but does not deserialise.

Definition at line 193 of file test_model_spec.py.

◆ test_an_unknown_component_type_lists_what_exists()

None test_model_spec.test_an_unknown_component_type_lists_what_exists ( )

Definition at line 140 of file test_model_spec.py.

◆ test_an_unknown_model_is_rejected()

None test_model_spec.test_an_unknown_model_is_rejected ( )

Definition at line 166 of file test_model_spec.py.

References _pipe().

◆ test_authored_units_survive_the_round_trip()

None test_model_spec.test_authored_units_survive_the_round_trip ( )
A file written in inches comes back in inches, not in converted floats.

Definition at line 218 of file test_model_spec.py.

References _pipe().

◆ test_bounds_are_enforced_in_canonical_units()

None test_model_spec.test_bounds_are_enforced_in_canonical_units ( )
A negative bore fails at load, not inside a Reynolds number.

Definition at line 121 of file test_model_spec.py.

References _pipe().

◆ test_component_schemas_are_data()

None test_model_spec.test_component_schemas_are_data ( )
The shipped declarations come from components.toml, not from Python.

The same guard the species registry has: someone adds a component type by
writing it into code because that felt quicker, and the data path quietly
becomes decorative.

Definition at line 47 of file test_model_spec.py.

◆ test_defaults_are_filled_and_tagged_as_defaults()

None test_model_spec.test_defaults_are_filled_and_tagged_as_defaults ( )

Definition at line 84 of file test_model_spec.py.

References _pipe().

◆ test_duplicate_parameters_are_rejected()

None test_model_spec.test_duplicate_parameters_are_rejected ( )

Definition at line 181 of file test_model_spec.py.

◆ test_round_trip_preserves_provenance_and_references()

None test_model_spec.test_round_trip_preserves_provenance_and_references ( )
Provenance lost on the first save is provenance that does not exist.

Definition at line 229 of file test_model_spec.py.

References _pipe().

◆ test_signal_ports_are_not_expected_to_be_plumbed()

None test_model_spec.test_signal_ports_are_not_expected_to_be_plumbed ( )
A valve's command port is not a leak.

Definition at line 305 of file test_model_spec.py.

◆ test_unconnected_fluid_ports_are_reported()

None test_model_spec.test_unconnected_fluid_ports_are_reported ( )
A dead end is a singular system; naming it beats a linear-algebra error.

Definition at line 297 of file test_model_spec.py.

References _pipe().

Variable Documentation

◆ MANUF

test_model_spec.MANUF = Provenance.MANUFACTURER

Definition at line 32 of file test_model_spec.py.