Skip to content

Commit 45cf1a7

Browse files
committed
tests for that
1 parent 9ef3e4d commit 45cf1a7

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/test_real_https.py

+28
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,34 @@ def test_https_implicit_storage():
5959
assert result == np.array([0.6909787], dtype="float32")
6060

6161

62+
def test_https_implicit_storage_file_not_found():
63+
"""
64+
Run a true test with a https FILE that is not found.
65+
Code raises a very descriptive exception via fsspec.
66+
Keep test to capture any changes in behaviour.
67+
"""
68+
test_file_uri = "https://esgf.ceda.ac.uk/thredds/fileServer/esg_cmip6/CMIP6/AerChemMIP/MOHC/UKESM1-0-LL/ssp370SST-lowNTCF/r1i1p1f2/Amon/cl/gn/latest/cl_Amon_UKESM1-0-LL_ssp370SST-lowNTCF_r1i1p1f2_gn_205001-209912.ncx"
69+
70+
with pytest.raises(FileNotFoundError):
71+
active = Active(test_file_uri, "cl")
72+
active._version = 1
73+
active._method = "min"
74+
result = active[0:3, 4:6, 7:9]
75+
76+
77+
def test_https_implicit_storage_wrong_url():
78+
"""
79+
Run a true test with a bogus URL.
80+
"""
81+
test_file_uri = "https://esgf.cedacow.ac.uk/thredds/fileServer/esg_cmip6/CMIP6/AerChemMIP/MOHC/UKESM1-0-LL/ssp370SST-lowNTCF/r1i1p1f2/Amon/cl/gn/latest/cl_Amon_UKESM1-0-LL_ssp370SST-lowNTCF_r1i1p1f2_gn_205001-209912.nc"
82+
83+
with pytest.raises(ValueError):
84+
active = Active(test_file_uri, "cl")
85+
active._version = 1
86+
active._method = "min"
87+
result = active[0:3, 4:6, 7:9]
88+
89+
6290
@pytest.mark.skip(reason="save time: test_https_dataset_implicit_storage is more general.")
6391
def test_https_dataset():
6492
"""Run a true test with a https DATASET."""

0 commit comments

Comments
 (0)