def test_load_from_varnames_bad_mapping(): mapping = {'attribute_check': ('grid_type', 'triangular'), 'faces': 'nv', 'nodes_lon': 'longitude', 'nodes_lat': 'latitude', 'boundaries': 'bnd', 'face_face_connectivity': 'nbe'} fname = 'non_compliant_ugrid.nc' with non_compliante_mesh(fname): with pytest.raises(KeyError): load_from_varnames(fname, mapping)
def test_load_from_varnames_bad_mapping(): mapping = { 'attribute_check': ('grid_type', 'triangular'), 'faces': 'nv', 'nodes_lon': 'longitude', 'nodes_lat': 'latitude', 'boundaries': 'bnd', 'face_face_connectivity': 'nbe' } fname = 'non_compliant_ugrid.nc' with non_compliante_mesh(fname): with pytest.raises(KeyError): load_from_varnames(fname, mapping)
def test_load_from_varnames_good_mapping(): mapping = {'attribute_check': ('grid_type', 'triangular'), 'faces': 'nv', 'nodes_lon': 'lon', 'nodes_lat': 'lat', 'boundaries': 'bnd', 'face_face_connectivity': 'nbe'} fname = 'non_compliant_ugrid.nc' with non_compliante_mesh(fname): ug = load_from_varnames(fname, mapping) assert isinstance(ug, UGrid)
def test_load_from_varnames_good_mapping(): mapping = { 'attribute_check': ('grid_type', 'triangular'), 'faces': 'nv', 'nodes_lon': 'lon', 'nodes_lat': 'lat', 'boundaries': 'bnd', 'face_face_connectivity': 'nbe' } fname = 'non_compliant_ugrid.nc' with non_compliante_mesh(fname): ug = load_from_varnames(fname, mapping) assert isinstance(ug, UGrid)