feat: named case-result load combinations with full GUI support
Snapshots the current development tree, headlined by proper load combinations (user request): a reusable LoadCombination entity of weighted completed static-case results (e.g. 1.2xDead + 1.6xLive). - core: LoadCombination/LoadCombinationItem entities, Project integration (lookup, unique ids, reference validation) - services: combinations.py (linear superposition + envelope), exported via services __init__ - commands: undoable Add/Delete/Update for combinations - GUI: Load Combinations manager dialog, Run-dialog evaluation, envelope display in Results panel, Combinations tab in Table dock - tests: unit coverage (validation, math, error paths) + integration superposition check vs a single factored run
This commit is contained in:
commit
f361fee969
560 changed files with 178701 additions and 0 deletions
51
tests/unit/test_formatting.py
Normal file
51
tests/unit/test_formatting.py
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
"""Unit tests for :mod:`otko.views.formatting` (no Qt required)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from otko.core import UnitSystem
|
||||
from otko.views.formatting import (
|
||||
DOF_LABELS,
|
||||
MASS_LABELS,
|
||||
RESTRAINT_LABELS,
|
||||
format_number,
|
||||
parse_float,
|
||||
parse_int,
|
||||
unit_label,
|
||||
)
|
||||
|
||||
|
||||
def test_label_tuples() -> None:
|
||||
assert DOF_LABELS == ("Ux", "Uy", "Uz", "Rx", "Ry", "Rz")
|
||||
assert MASS_LABELS == ("Mx", "My", "Mz", "Ixx", "Iyy", "Izz")
|
||||
assert RESTRAINT_LABELS == ("Ux", "Uy", "Uz", "Rx", "Ry", "Rz")
|
||||
|
||||
|
||||
def test_format_number() -> None:
|
||||
assert format_number(50.0) == "50"
|
||||
assert format_number(1.5) == "1.5"
|
||||
|
||||
|
||||
def test_parse_float_required() -> None:
|
||||
with pytest.raises(ValueError):
|
||||
parse_float("", "x")
|
||||
|
||||
|
||||
def test_parse_float_allow_empty() -> None:
|
||||
assert parse_float("", "x", allow_empty=True) == 0.0
|
||||
|
||||
|
||||
def test_parse_int_rejects_fractional() -> None:
|
||||
with pytest.raises(ValueError):
|
||||
parse_int("1.5", "x")
|
||||
|
||||
|
||||
def test_unit_label() -> None:
|
||||
assert unit_label("force", UnitSystem.SI_M_N) == "N"
|
||||
assert unit_label("moment", UnitSystem.US_FT_KIP) == "kip·ft"
|
||||
|
||||
|
||||
def test_unit_label_unknown_quantity() -> None:
|
||||
with pytest.raises(ValueError):
|
||||
unit_label("temperature", UnitSystem.SI_M_N)
|
||||
Loading…
Reference in a new issue