UnitModelTestHarness¶
- class flexops.testing.UnitModelTestHarness¶
Subclass per unit model; pytest collects the subclass.
- expected_dof¶
Degrees of freedom expected once every registered
role="input"IO variable is fixed.- Type:
- expected_solution¶
Mapping of dotted component name (e.g.
"power_electrical[0]") to its expected solved value; doubles as a solution-regression baseline. Empty skipstest_solution.
- configure()¶
Build and return
(model, unit). Override this.- Raises:
NotImplementedError – Always, on the base class.
- test_build()¶
configure()builds without exception; declared ports are populated.
- test_dof()¶
Fixing every registered input drives DoF to
expected_dof.
- test_energy_naming()¶
power_electrical/power_thermal exist iff registered; no bare names.
- test_io_registration()¶
Every registered IO variable exists, carries units, and has a doc=.
- test_solution()¶
Solved values match
expected_solutionwithinsolution_rtol.
- test_solve()¶
Solving with every registered input fixed terminates optimally.
- test_units_consistent()¶
The unit’s variables and constraints are dimensionally consistent.