Files
TJWaterServerBinary/tests/unit/test_dma_leakage_flow_units.py
T
jiang 5966d039de refactor(backend)!: separate algorithm and data layers
Reorganize algorithm packages by business responsibility, move orchestration into services, and keep database access behind pooled repositories.

Harden analysis API validation, remove unsafe legacy simulation endpoints, and add regression and architecture boundary coverage.

BREAKING CHANGE: legacy algorithm module paths and obsolete simulation endpoints are removed.
2026-09-04 17:30:55 +08:00

21 lines
557 B
Python

import pytest
from app.algorithms.dma_leakage_estimation.genetic_optimizer import DmaLeakageOptimizer
@pytest.mark.parametrize(
("unit", "expected"),
[
("m3/s", 1.0),
("m³/s", 1.0),
("m3/h", 3600.0),
("m³/h", 3600.0),
],
)
def test_dma_leakage_optimizer_accepts_display_flow_units(unit, expected):
assert DmaLeakageOptimizer._flow_from_m3s(1.0, unit) == expected
def test_dma_leakage_optimizer_accepts_display_flow_units_for_input():
assert DmaLeakageOptimizer._flow_to_m3s(3600.0, "m³/h") == 1.0