          rs = GDALRaster(self.rs_path, write=False)
          band = rs.bands[0]
  
          # Setting attributes in write mode raises exception in the _flush method
          self.assertRaises(GDALException, setattr, band, 'nodata_value', 10)
  
      def test_band_data_setters(self):
          # Create in-memory raster and get band
          rsmem = GDALRaster({
              'datatype': 1,
 
</s> remove             self.assertRaises(TypeError, SimpleView.as_view, **kwargs)
 </s> add             with self.assertRaises(TypeError):
                SimpleView.as_view(**kwargs) </s> remove         self.assertRaises(FieldError, test_gmbh.save)
 </s> add         with self.assertRaises(FieldError):
            test_gmbh.save() </s> remove         self.assertRaises(ValueError, qs.aggregate, Union('name'))
 </s> add         with self.assertRaises(ValueError):
            qs.aggregate(Union('name')) </s> remove         self.assertRaises(ContentNotRenderedError, lambda: response.content)
 </s> add         with self.assertRaises(ContentNotRenderedError):
            response.content </s> remove             self.assertRaises(ValueError, wkb_w._set_byteorder, bad_byteorder)
 </s> add             with self.assertRaises(ValueError):
                wkb_w._set_byteorder(bad_byteorder)
        with self.assertRaises(GDALException):
            setattr(band, 'nodata_value', 10)
          rs = GDALRaster(self.rs_path, write=False)
          band = rs.bands[0]
  
          # Setting attributes in write mode raises exception in the _flush method
        with self.assertRaises(GDALException):
            setattr(band, 'nodata_value', 10)
  
      def test_band_data_setters(self):
          # Create in-memory raster and get band
          rsmem = GDALRaster({
              'datatype': 1,
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/gis_tests/gdal_tests/test_raster.py