Skip to content

Commit

Permalink
DAS-2276: better example: test_convert_uint8_3_multiband_to_raster
Browse files Browse the repository at this point in the history
  • Loading branch information
flamingbear committed Dec 13, 2024
1 parent 32fb4db commit 25742bf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/unit/test_browse.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ def test_convert_uint16_3_multiband_to_raster(self):
assert_array_equal(expected_raster, actual_raster.data, strict=True)

def test_convert_uint8_3_multiband_to_raster(self):
"""Ensure valid data is unchange when input is uint8."""
"""Ensure valid data is unchanged when input is uint8."""
scale_data = np.array(
[
[10, 200, 30, 40],
Expand Down Expand Up @@ -525,20 +525,20 @@ def test_convert_4_multiband_uint8_to_raster(self):
g_data = r_data.copy()
b_data = r_data.copy()

a_data = np.ones_like(self.data) * 255
a_data = np.ones_like(r_data) * 255
a_data[0, 0] = 0

to_numpy_result = np.stack([r_data, g_data, b_data, a_data])

ds.to_numpy.return_value = to_numpy_result

expected_raster = to_numpy_result.astype('uint8')
expected_raster = to_numpy_result

actual_raster = convert_mulitband_to_raster(ds)
assert_array_equal(expected_raster, actual_raster.data, strict=True)

def test_convert_4_multiband_uint16_to_raster(self):
"""4-band 'uint16' images are scaled if the range exceeds 255."""
"""4-band 'uint16' images are scaled if their range exceeds 255."""
ds = Mock(DataArray)
ds.rio.count = 4

Expand Down

0 comments on commit 25742bf

Please sign in to comment.