Skip to content

Commit e418c9b

Browse files
committed
add an assert checking that env change triggers velocity change + trigger the change with mark_updated + a TODO label to make it automatic
1 parent 346f44e commit e418c9b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tests/unit_tests/dynamics/test_terminal_velocity.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,26 @@ def test_ice_particle_terminal_velocities_basics(backend_class, ice_variant):
146146
{"temperature": 233 * si.kelvin, "pressure": 300 * si.hectopascal},
147147
{"temperature": 270 * si.kelvin, "pressure": 1000 * si.hectopascal},
148148
]
149+
terminal_velocity = None
149150
for setting in atmospheric_settings:
150151

151152
particulator.environment["T"] = setting["temperature"]
152153
particulator.environment["p"] = setting["pressure"]
153154

155+
# TODO #1606 the line below should not be needed (auto update when env variables change)
156+
particulator.attributes.mark_updated("signed water mass")
157+
154158
# act
155159
particulator.run(steps=1)
160+
161+
# assert
162+
if terminal_velocity is not None:
163+
assert all(
164+
terminal_velocity
165+
!= particulator.attributes["terminal velocity"].to_ndarray()
166+
)
167+
156168
terminal_velocity = particulator.attributes["terminal velocity"].to_ndarray()
157-
# TODO #1606 update terminal velocity attribute when environment variables change
158-
print(terminal_velocity)
159169

160170
# assert
161171
assert all(~np.isnan(terminal_velocity))

0 commit comments

Comments
 (0)