Skip to content

Commit f21e5f5

Browse files
committed
test dis first gwf init
1 parent befe389 commit f21e5f5

File tree

4 files changed

+37
-26
lines changed

4 files changed

+37
-26
lines changed

flopy4/mf6/gwf/chd.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@
1010
from flopy4.mf6 import Package
1111

1212

13-
@xattree
13+
@xattree(multi="list")
1414
class Chd(Package):
15-
multi = True
16-
1715
@define(slots=False)
1816
class Steps:
1917
all: bool = field()

pixi.lock

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/test_component.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_init_empty_sim():
2020
sim = Simulation()
2121

2222

23-
def test_init_gwf():
23+
def test_init_gwf_explicit_dims():
2424
time = ModelTime(perlen=[1.0], nstp=[1], tsmult=[1.0])
2525
grid = StructuredGrid(nlay=1, nrow=2, ncol=2)
2626
dims = {
@@ -42,8 +42,6 @@ def test_init_gwf():
4242
oc=oc,
4343
npf=npf,
4444
chd=[chd],
45-
# TODO get dims/coords from dis
46-
# and remove explicit arg below
4745
dims=dims,
4846
)
4947

@@ -57,7 +55,24 @@ def test_init_gwf():
5755
assert gwf.data.ic is ic.data
5856
assert gwf.data.oc is oc.data
5957
assert gwf.data.npf is npf.data
60-
assert gwf.data.chd_0 is chd.data
58+
assert np.array_equal(npf.k, np.ones(4))
59+
assert np.array_equal(npf.data.k, np.ones(4))
60+
61+
62+
def test_init_gwf_dis_first():
63+
dis = Dis()
64+
gwf = Gwf(dis=dis)
65+
ic = Ic(parent=gwf)
66+
oc = Oc(parent=gwf, strict=False)
67+
npf = Npf(parent=gwf)
68+
chd = Chd(parent=gwf, strict=False)
69+
70+
assert isinstance(gwf.data, DataTree)
71+
assert gwf.dis is dis
72+
assert gwf.ic is ic
73+
assert gwf.oc is oc
74+
assert gwf.npf is npf
75+
assert gwf.chd[0] is chd
6176
assert np.array_equal(npf.k, np.ones(4))
6277
assert np.array_equal(npf.data.k, np.ones(4))
6378

@@ -84,8 +99,6 @@ def test_init_sim():
8499
oc=oc,
85100
npf=npf,
86101
chd=[chd],
87-
# TODO get dims/coords from dis
88-
# and remove explicit arg below
89102
dims=dims,
90103
)
91104
tdis = Tdis(dims=dims)

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)