Skip to content

Commit 955676a

Browse files
committed
parametrize test
1 parent 6c794d1 commit 955676a

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

autotest/test_codec.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1+
import pytest
2+
3+
import modflow_devtools.models as models
14
from modflow_devtools.codec import make_parser
25

6+
MODELS = [name for name in models.get_models().keys() if name.startswith("mf6/")]
7+
38

4-
def test_parser():
9+
@pytest.mark.parametrize("model_name", MODELS)
10+
def test_parser(model_name, function_tmpdir):
11+
workspace = models.copy_to(function_tmpdir, model_name)
12+
nam_path = next(iter(workspace.glob("*.nam")))
13+
text = nam_path.open().read()
514
parser = make_parser()
6-
text = """
7-
BEGIN OPTIONS
8-
AN OPTION
9-
ANOTHER OPTION
10-
END OPTIONS
11-
BEGIN PACKAGEDATA
12-
END PACKAGEDATA
13-
"""
1415
tree = parser.parse(text)
1516
print(tree.pretty())

modflow_devtools/dfn.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ class Dfn(TypedDict):
164164
name: str
165165
advanced: bool
166166
multi: bool
167-
ref: Optional[Ref]
168-
sln: Optional[Sln]
169-
fkeys: Optional[Dfns]
167+
ref: Ref | None
168+
sln: Sln | None
169+
fkeys: Dfns | None
170170

171171
@staticmethod
172172
def _load_v1_flat(f, common: dict | None = None) -> tuple[Mapping, list[str]]:

modflow_devtools/mf6.lark

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
start: [WS] block+ [WS]
2-
32
block: "begin"i CNAME _NL _content "end"i CNAME _NL
43
_content: line* [WS]
54
line: [WS] value* _NL
65
value: WORD | NUMBER
76

8-
97
%import common.NEWLINE -> _NL
108
%import common.WS
119
%import common.WS_INLINE
1210
%import common.CNAME
1311
%import common.WORD
1412
%import common.NUMBER
15-
%ignore WS_INLINE
13+
%import common.SH_COMMENT
14+
%ignore WS_INLINE
15+
%ignore SH_COMMENT

0 commit comments

Comments
 (0)