56 lines
1.0 KiB
Python
56 lines
1.0 KiB
Python
from __future__ import annotations
|
|
|
|
import unittest
|
|
from math import log10, sqrt
|
|
from unittest.mock import patch
|
|
|
|
from app.simulation.components.amesim.flow.pipes import (
|
|
AmesimPnl0001,
|
|
AmesimPnl0002,
|
|
AmesimPnl00r,
|
|
)
|
|
from app.simulation.core.medium import IdealGasMedium
|
|
from app.simulation.registry import COMPONENT_MODEL_REGISTRY
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AmesimPnl0001ComponentTests(unittest.TestCase):
|
|
def setUp(self) -> None:
|
|
self.medium = IdealGasMedium()
|
|
|
|
|
|
def test_rejects_fractional_integer_parameters(self) -> None:
|
|
with self.assertRaisesRegex(ValueError, "gi must be an integer"):
|
|
COMPONENT_MODEL_REGISTRY["amesim_pnl0001"].create(
|
|
"pnl_1",
|
|
self.medium,
|
|
{"gi": 1.5},
|
|
)
|
|
with self.assertRaisesRegex(ValueError, "must be one of"):
|
|
COMPONENT_MODEL_REGISTRY["amesim_pnl0001"].create(
|
|
"pnl_1",
|
|
self.medium,
|
|
{"mode": 1.5},
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|