Skip to content

Commit cebd494

Browse files
Added additional assertions to unit tests to check valid and invalid edge ids on boundary conditions.
1 parent 6c3f313 commit cebd494

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

tests/conventions/test_ugrid.py

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -945,19 +945,39 @@ def test_has_valid_face_edge_connectivity():
945945
'Mesh2_face_edges': mesh2_face_edges,
946946
})
947947

948-
dataset_fill_value_in_actual_range = dataset.copy()
948+
dataset_fill_value_below_range = dataset.copy()
949949

950-
dataset_fill_value_in_theoretical_range = dataset.copy()
950+
dataset_fill_value_in_range_on_lower_boundary = dataset.copy()
951+
952+
dataset_fill_value_in_range = dataset.copy()
953+
954+
dataset_fill_value_in_range_on_upper_boundary = dataset.copy()
955+
956+
dataset_fill_value_above_range = dataset.copy()
951957

952958
# Make sure original dataset is valid
953959
assert dataset.ems.topology.has_valid_face_edge_connectivity is True
954960

955-
dataset_fill_value_in_actual_range['Mesh2_face_edges'].encoding['_FillValue'] = 2
961+
# Test valid and invalid fill values
962+
dataset_fill_value_below_range['Mesh2_face_edges'].encoding['_FillValue'] = -1
963+
964+
assert dataset_fill_value_below_range.ems.topology.has_valid_face_edge_connectivity is True
965+
966+
dataset_fill_value_in_range_on_lower_boundary['Mesh2_face_edges'].encoding['_FillValue'] = 0
956967

957968
with pytest.warns(ConventionViolationWarning):
958-
assert dataset_fill_value_in_actual_range.ems.topology.has_valid_face_edge_connectivity is not True
969+
assert dataset_fill_value_in_range_on_lower_boundary.ems.topology.has_valid_face_edge_connectivity is not True
959970

960-
dataset_fill_value_in_theoretical_range['Mesh2_face_edges'].encoding['_FillValue'] = 88
971+
dataset_fill_value_in_range['Mesh2_face_edges'].encoding['_FillValue'] = 44
961972

962973
with pytest.warns(ConventionViolationWarning):
963-
assert dataset_fill_value_in_theoretical_range.ems.topology.has_valid_face_edge_connectivity is not True
974+
assert dataset_fill_value_in_range.ems.topology.has_valid_face_edge_connectivity is not True
975+
976+
dataset_fill_value_in_range_on_upper_boundary['Mesh2_face_edges'].encoding['_FillValue'] = 88
977+
978+
with pytest.warns(ConventionViolationWarning):
979+
assert dataset_fill_value_in_range_on_upper_boundary.ems.topology.has_valid_face_edge_connectivity is not True
980+
981+
dataset_fill_value_above_range['Mesh2_face_edges'].encoding['_FillValue'] = 89
982+
983+
assert dataset_fill_value_above_range.ems.topology.has_valid_face_edge_connectivity is True

0 commit comments

Comments
 (0)