Skip to content

Commit ce9d428

Browse files
committed
Add test_parse_edge_node_mapping
Mainly as developer documentation, so its clear what the input and output should be
1 parent 7f11781 commit ce9d428

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

tests/test_sgrid.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1-
from hypothesis import given
1+
import pytest
2+
from hypothesis import example, given
23

34
from parcels._core import sgrid
45
from tests.strategies import sgrid as sgrid_strategies
56

67

8+
@example(
9+
edge_node_padding=[
10+
("edge1", "node1", sgrid.Padding.NONE),
11+
("edge2", "node2", sgrid.Padding.LOW),
12+
]
13+
)
714
@given(sgrid_strategies.edge_node_padding_list(min_size=1, max_size=3))
815
def test_edge_node_mapping_metadata_roundtrip(edge_node_padding):
916
serialized = sgrid.serialize_edge_node_mapping(edge_node_padding)
1017
parsed = sgrid.parse_edge_node_mapping(serialized)
1118
assert parsed == edge_node_padding
19+
20+
21+
@pytest.mark.parametrize(
22+
"input_, expected",
23+
[
24+
(
25+
"edge1: node1(padding: none)",
26+
[("edge1", "node1", sgrid.Padding.NONE)],
27+
),
28+
],
29+
)
30+
def test_parse_edge_node_mapping(input_, expected):
31+
assert sgrid.parse_edge_node_mapping(input_) == expected

0 commit comments

Comments
 (0)