Skip to content

Commit

Permalink
changed ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
veenstrajelmer committed Sep 25, 2024
1 parent 9a00e4c commit fc3c2d4
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions tests/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,21 @@ def test_download_hycom(tmp_path):
assert ds.time.to_pandas().iloc[-1] == pd.Timestamp('2010-01-02')


@pytest.mark.requiressecrets
@pytest.mark.unittest
def test_download_era5_unsupported_varkey():
date_min = '2010-01-31'
date_max = '2010-02-01'
longitude_min, longitude_max, latitude_min, latitude_max = 2, 3, 51, 52 #test domain
varkey = 'unexisting'
with pytest.raises(KeyError) as e:
dfmt.download_ERA5(varkey,
longitude_min=longitude_min, longitude_max=longitude_max, latitude_min=latitude_min, latitude_max=latitude_max,
date_min=date_min, date_max=date_max,
dir_output='.', overwrite=True)
assert '"unexisting" not available' in str(e.value)


@pytest.mark.requiressecrets
@pytest.mark.unittest
@pytest.mark.timeout(60) # useful since CDS downloads are terribly slow sometimes, so skip in that case
Expand Down Expand Up @@ -264,19 +279,3 @@ def test_download_era5(file_nc_era5_pattern):
msl_encoding = ds['msl'].encoding
assert str(msl_encoding['dtype']) == 'float32'
assert 'scale_factor' not in msl_encoding.keys()


@pytest.mark.requiressecrets
@pytest.mark.unittest
@pytest.mark.timeout(60) # useful since CDS downloads are terribly slow sometimes, so skip in that case
def test_download_era5_unsupported_varkey():
date_min = '2010-01-31'
date_max = '2010-02-01'
longitude_min, longitude_max, latitude_min, latitude_max = 2, 3, 51, 52 #test domain
varkey = 'unexisting'
with pytest.raises(KeyError) as e:
dfmt.download_ERA5(varkey,
longitude_min=longitude_min, longitude_max=longitude_max, latitude_min=latitude_min, latitude_max=latitude_max,
date_min=date_min, date_max=date_max,
dir_output='.', overwrite=True)
assert '"unexisting" not available' in str(e.value)

0 comments on commit fc3c2d4

Please sign in to comment.