Skip to content

Commit 36ba41c

Browse files
committed
Testing: Increase coverage
1 parent 9309721 commit 36ba41c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Diff for: tests/test_eccodes.py

+17
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,13 @@ def test_grib_get_double_elements():
446446
assert elems == elems2
447447

448448

449+
def test_grib_get_values():
450+
gid = eccodes.codes_grib_new_from_samples("gg_sfc_grib2")
451+
with pytest.raises(TypeError):
452+
eccodes.codes_get_values(gid, str)
453+
eccodes.codes_release(gid)
454+
455+
449456
def test_grib_geoiterator():
450457
gid = eccodes.codes_grib_new_from_samples("reduced_gg_pl_256_grib2")
451458
iterid = eccodes.codes_grib_iterator_new(gid, 0)
@@ -499,6 +506,9 @@ def test_grib_nearest_multiple():
499506
eccodes.codes_release(gid)
500507
assert nearest[0].index == 1770
501508
assert nearest[1].index == 2500
509+
# Error condition
510+
with pytest.raises(ValueError):
511+
eccodes.codes_grib_find_nearest_multiple(gid, is_lsm, (1, 2), (1, 2, 3))
502512

503513

504514
def test_grib_ecc_1042():
@@ -953,5 +963,12 @@ def test_grib_nearest2():
953963
assert sorted(expected_indexes) == sorted(returned_indexes)
954964
assert math.isclose(nearest[0].value, 295.22085, abs_tol=0.0001)
955965
assert math.isclose(nearest[2].distance, 24.16520, abs_tol=0.0001)
966+
967+
# Error conditions
968+
with pytest.raises(eccodes.FunctionNotImplementedError):
969+
eccodes.codes_grib_nearest_find(nid, gid, lat, lon, flags, is_lsm=True)
970+
with pytest.raises(eccodes.FunctionNotImplementedError):
971+
eccodes.codes_grib_nearest_find(nid, gid, lat, lon, flags, False, npoints=5)
972+
956973
eccodes.codes_release(gid)
957974
eccodes.codes_grib_nearest_delete(nid)

0 commit comments

Comments
 (0)