@@ -3527,7 +3527,37 @@ def test_apply_append_math_keep_context(con100):
35273527 ({}, "result.tiff" , {"format" : "GTiff" }, b"this is GTiff data" ),
35283528 ({}, "result.nc" , {"format" : "netCDF" }, b"this is netCDF data" ),
35293529 ({}, "result.meh" , {"format" : "netCDF" }, b"this is netCDF data" ),
3530+ (
3531+ {"format" : "GTiff" },
3532+ "result.tiff" ,
3533+ {"format" : "GTiff" },
3534+ TypeError ("got an unexpected keyword argument 'format'" ),
3535+ ),
3536+ (
3537+ {"format" : "netCDF" },
3538+ "result.tiff" ,
3539+ {"format" : "NETCDF" },
3540+ TypeError ("got an unexpected keyword argument 'format'" ),
3541+ ),
3542+ (
3543+ {"format" : "netCDF" },
3544+ "result.json" ,
3545+ {"format" : "JSON" },
3546+ TypeError ("got an unexpected keyword argument 'format'" ),
3547+ ),
35303548 ({"options" : {}}, "result.tiff" , {}, b"this is GTiff data" ),
3549+ (
3550+ {"options" : {"quality" : "low" }},
3551+ "result.tiff" ,
3552+ {"options" : {"quality" : "low" }},
3553+ TypeError ("got an unexpected keyword argument 'options'" ),
3554+ ),
3555+ (
3556+ {"options" : {"colormap" : "jet" }},
3557+ "result.tiff" ,
3558+ {"options" : {"quality" : "low" }},
3559+ TypeError ("got an unexpected keyword argument 'options'" ),
3560+ ),
35313561 ],
35323562)
35333563def test_save_result_and_download (
@@ -3550,15 +3580,17 @@ def post_result(request, context):
35503580
35513581 cube = con100 .load_collection ("S2" )
35523582 if save_result_kwargs :
3553- res = cube .save_result (** save_result_kwargs )
3554- else :
3555- res = cube
3583+ cube = cube .save_result (** save_result_kwargs )
35563584
35573585 path = tmp_path / download_filename
3558- res .download (str (path ), ** download_kwargs )
3559-
3560- assert path .read_bytes () == expected
3561- assert post_result_mock .call_count == 1
3586+ if isinstance (expected , Exception ):
3587+ with pytest .raises (type (expected ), match = re .escape (str (expected ))):
3588+ cube .download (str (path ), ** download_kwargs )
3589+ assert post_result_mock .call_count == 0
3590+ else :
3591+ cube .download (str (path ), ** download_kwargs )
3592+ assert path .read_bytes () == expected
3593+ assert post_result_mock .call_count == 1
35623594
35633595
35643596@pytest .mark .parametrize (
0 commit comments