99from modflowapi import Callbacks , ModflowApi , run_simulation
1010from modflowapi .extensions .pakbase import AdvancedPackage , ArrayPackage , ListPackage
1111
12- data_pth = Path ("../examples/data" )
12+ data_pth = Path ("../docs/ examples/data" )
1313pytestmark = pytest .mark .extensions
1414os = system ()
15- so = "libmf6" + (
16- ".so"
17- if os == "Linux"
18- else ".dylib"
19- if os == "Darwin"
20- else ".dll"
21- if os == "Windows"
22- else None
23- )
15+ so = "libmf6" + (".so" if os == "Linux" else ".dylib" if os == "Darwin" else ".dll" if os == "Windows" else None )
2416if so is None :
2517 pytest .skip ("Unsupported operating system" , allow_module_level = True )
2618
@@ -76,9 +68,7 @@ def callback(sim, step):
7668 raise AssertionError ("ApiModel size is incorrect" )
7769
7870 if (model .kper , model .kstp ) != (- 1 , - 1 ):
79- raise AssertionError (
80- "ApiModel has advanced prior to initialization callback"
81- )
71+ raise AssertionError ("ApiModel has advanced prior to initialization callback" )
8272
8373 dis = model .dis
8474 if not isinstance (dis , ArrayPackage ):
@@ -102,15 +92,11 @@ def callback(sim, step):
10292
10393 elif step == Callbacks .stress_period_start :
10494 if sim .kstp != 0 :
105- raise AssertionError (
106- "Solution advanced prior to stress_period_start callback"
107- )
95+ raise AssertionError ("Solution advanced prior to stress_period_start callback" )
10896
10997 elif step == Callbacks .timestep_start :
11098 if sim .iteration != - 1 :
111- raise AssertionError (
112- "Solution advanced prior to timestep_start callback"
113- )
99+ raise AssertionError ("Solution advanced prior to timestep_start callback" )
114100
115101 factor = ((1 + sim .kstp ) / sim .nstp ) * 0.5
116102 spd = sim .test_model .wel .stress_period_data .values
@@ -169,9 +155,7 @@ def callback(sim, step):
169155 raise AssertionError ("ApiModel size is incorrect" )
170156
171157 if (model .kper , model .kstp ) != (- 1 , - 1 ):
172- raise AssertionError (
173- "ApiModel has advanced prior to initialization callback"
174- )
158+ raise AssertionError ("ApiModel has advanced prior to initialization callback" )
175159
176160 dis = model .dis
177161 if not isinstance (dis , ArrayPackage ):
@@ -195,15 +179,11 @@ def callback(sim, step):
195179
196180 elif step == Callbacks .stress_period_start :
197181 if sim .kstp != 0 :
198- raise AssertionError (
199- "Solution advanced prior to stress_period_start callback"
200- )
182+ raise AssertionError ("Solution advanced prior to stress_period_start callback" )
201183
202184 elif step == Callbacks .timestep_start :
203185 if sim .iteration != - 1 :
204- raise AssertionError (
205- "Solution advanced prior to timestep_start callback"
206- )
186+ raise AssertionError ("Solution advanced prior to timestep_start callback" )
207187
208188 factor = 0.75
209189 spd = sim .gwf_1 .chd_left .stress_period_data .values
@@ -253,9 +233,7 @@ def callback(sim, step):
253233 raise AssertionError ("ApiModel size is incorrect" )
254234
255235 if (model .kper , model .kstp ) != (- 1 , - 1 ):
256- raise AssertionError (
257- "ApiModel has advanced prior to initialization callback"
258- )
236+ raise AssertionError ("ApiModel has advanced prior to initialization callback" )
259237
260238 dis = model .dis
261239 if not isinstance (dis , ArrayPackage ):
@@ -275,15 +253,11 @@ def callback(sim, step):
275253
276254 elif step == Callbacks .stress_period_start :
277255 if sim .kstp != 0 :
278- raise AssertionError (
279- "Solution advanced prior to stress_period_start callback"
280- )
256+ raise AssertionError ("Solution advanced prior to stress_period_start callback" )
281257
282258 elif step == Callbacks .timestep_start :
283259 if sim .iteration != - 1 :
284- raise AssertionError (
285- "Solution advanced prior to timestep_start callback"
286- )
260+ raise AssertionError ("Solution advanced prior to timestep_start callback" )
287261
288262 factor = 1.75
289263 spd = sim .gwf_1 .rch .stress_period_data .values
@@ -362,9 +336,7 @@ def callback(sim, step):
362336 wel .rhs = rhs
363337
364338 rhs2 = wel .get_advanced_var ("rhs" )
365- np .testing .assert_allclose (
366- rhs , rhs2 , err_msg = "rhs variable not being properly set"
367- )
339+ np .testing .assert_allclose (rhs , rhs2 , err_msg = "rhs variable not being properly set" )
368340
369341 hcof = wel .hcof
370342 hcof [0 :3 ] = np .abs (rhs )[0 :3 ] / 2
@@ -373,17 +345,13 @@ def callback(sim, step):
373345
374346 hcof2 = wel .get_advanced_var ("hcof" )
375347
376- np .testing .assert_allclose (
377- hcof , hcof2 , err_msg = "hcof is not being properly set"
378- )
348+ np .testing .assert_allclose (hcof , hcof2 , err_msg = "hcof is not being properly set" )
379349
380350 rhs *= 1.2
381351 wel .set_advanced_var ("rhs" , rhs )
382352 rhs3 = wel .rhs
383353
384- np .testing .assert_allclose (
385- rhs , rhs3 , err_msg = "set advanced var method not working properly"
386- )
354+ np .testing .assert_allclose (rhs , rhs3 , err_msg = "set advanced var method not working properly" )
387355
388356 npf = model .npf
389357
0 commit comments