@@ -278,9 +278,10 @@ def test_rs_setgeoreference_esri_skewed_roundtrips():
278278 # Three-arg form targets a specific band; read it back with the getter.
279279 ("RS_BandNoDataValue(RS_SetBandNoDataValue(RS_Example(), 1, 0), 1)" , 0.0 ),
280280 ("RS_BandNoDataValue(RS_SetBandNoDataValue(RS_Example(), 2, 255), 2)" , 255.0 ),
281- # A null nodata value yields a null raster, so the getter returns null.
281+ # A null nodata value clears the addressed band's nodata (band 1 starts
282+ # at 127), so the getter then reads back null for that band.
282283 (
283- "RS_BandNoDataValue(RS_SetBandNoDataValue(RS_Example(), CAST(NULL AS DOUBLE)), 1)" ,
284+ "RS_BandNoDataValue(RS_SetBandNoDataValue(RS_Example(), 1, CAST(NULL AS DOUBLE)), 1)" ,
284285 None ,
285286 ),
286287 ],
@@ -289,12 +290,15 @@ def test_rs_setbandnodatavalue(expr, expected):
289290 SedonaDB ().assert_query_result (f"SELECT { expr } " , expected )
290291
291292
292- def test_rs_setbandnodatavalue_two_arg_requires_single_band ():
293+ @pytest .mark .parametrize ("value" , ["0" , "CAST(NULL AS DOUBLE)" ])
294+ def test_rs_setbandnodatavalue_two_arg_requires_single_band (value ):
293295 # The 2-arg form is ambiguous on a multiband raster (RS_Example has multiple
294- # bands), so it errors rather than silently setting only band 1.
296+ # bands), so it errors rather than silently setting only band 1. A null value
297+ # clears the band's nodata rather than short-circuiting to a null raster, so
298+ # it hits the same ambiguity and errors too.
295299 with pytest .raises (Exception , match = "specify which band" ):
296300 SedonaDB ().assert_query_result (
297- "SELECT RS_SetBandNoDataValue(RS_Example(), 0 )" , None
301+ f "SELECT RS_SetBandNoDataValue(RS_Example(), { value } )" , None
298302 )
299303
300304
0 commit comments