"""Jet boundary-condition hook: velocity implemented, pressure reserved (host only, no CUDA).""" import pytest from CelerisLab.body.jets import Jet, Parallel, Tube def region(): return Tube((16., 12.), 0., 3., .7) def test_default_is_velocity_and_survives_amplitude_change(): jet = Jet(region(), Parallel(0.), amplitude=.01) assert jet.condition == "velocity" assert jet.with_amplitude(-.02).condition == "velocity" # positional calls keep their meaning; condition is the new last field assert (Jet(region(), Parallel(0.), "parabolic", .01, "velocity") == Jet(region(), Parallel(0.), "parabolic", .01)) def test_pressure_is_rejected_before_amplitude_validation(): # An amplitude that the velocity check would reject must not decide the error. for amplitude in (0., 5., float("nan")): with pytest.raises(NotImplementedError, match="pressure jets are reserved"): Jet(region(), Parallel(0.), amplitude=amplitude, condition="pressure") with pytest.raises(NotImplementedError): Jet(region(), None, profile="no-such-profile", condition="pressure") def test_unknown_condition_is_a_value_error(): for condition in ("Velocity", "flow_rate", "", None): with pytest.raises(ValueError, match="condition"): Jet(region(), Parallel(0.), amplitude=.01, condition=condition)