Skip to content

Commit

Permalink
DAS-2280: Fix typo and make random type explicit.
Browse files Browse the repository at this point in the history
  • Loading branch information
flamingbear committed Dec 20, 2024
1 parent 78ee92c commit 189ed21
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Changelog](http://keepachangelog.com/en/1.0.0/).
`NODATA_IDX` (255) in its stead. A color of (0,0,0,0) was previosly set to
both the indexes (254 and 255) in the ouput PNGs and now only 255 will have
this value. This change ensures the roundtrip from single band to RGBA to
Paletted PNG is consistent.
paletted PNG is consistent.

## [v2.1.0] - 2024-12-13

Expand Down
14 changes: 7 additions & 7 deletions tests/unit/test_browse.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ def test_convert_5_multiband_to_raster(self):
)

def test_standardize_raster_for_writing_jpeg_3band(self):
raster = self.random.integers(255, size=(3, 5, 6))
raster = self.random.integers(255, size=(3, 5, 6), dtype='uint8')
count = 'irrelevant'
driver = 'JPEG'
expected_raster = np.copy(raster)
Expand All @@ -667,7 +667,7 @@ def test_standardize_raster_for_writing_jpeg_3band(self):
np.testing.assert_array_equal(expected_raster, actual_raster, strict=True)

def test_standardize_raster_for_writing_jpeg_4band(self):
raster = self.random.integers(255, size=(4, 7, 8))
raster = self.random.integers(255, size=(4, 7, 8), dtype='uint8')
driver = 'JPEG'
count = 'irrelevant'
expected_raster = np.copy(raster[0:3, :, :])
Expand All @@ -680,7 +680,7 @@ def test_standardize_raster_for_writing_jpeg_4band(self):

@patch('hybig.browse.palettize_raster')
def test_standardize_raster_for_writing_png_4band(self, palettize_mock):
raster = self.random.integers(255, size=(4, 7, 8))
raster = self.random.integers(255, size=(4, 7, 8), dtype='uint8')
driver = 'PNG'
count = 'not 1'

Expand All @@ -690,7 +690,7 @@ def test_standardize_raster_for_writing_png_4band(self, palettize_mock):

@patch('hybig.browse.palettize_raster')
def test_standardize_raster_for_writing_png_3band(self, palettize_mock):
raster = self.random.integers(255, size=(3, 7, 8))
raster = self.random.integers(255, size=(3, 7, 8), dtype='uint8')
driver = 'PNG'
count = 'not 1'

Expand All @@ -700,7 +700,7 @@ def test_standardize_raster_for_writing_png_3band(self, palettize_mock):

@patch('hybig.browse.palettize_raster')
def test_prepare_1band_raster_for_writing_png(self, palettize_mock):
raster = self.random.integers(255, size=(1, 7, 8))
raster = self.random.integers(255, size=(1, 7, 8), dtype='uint8')
driver = 'PNG'
count = 1
palettize_mock.return_value = (None, None)
Expand All @@ -711,7 +711,7 @@ def test_prepare_1band_raster_for_writing_png(self, palettize_mock):
@patch('hybig.browse.get_color_map_from_image')
def test_palettize_raster_no_alpha_layer(self, get_color_map_mock, image_mock):
"""Test that the quantize function is called by a correct image."""
raster = self.random.integers(255, dtype='uint8', size=(3, 10, 11))
raster = self.random.integers(255, size=(3, 10, 11), dtype='uint8')

quantized_output = Image.fromarray(
self.random.integers(254, size=(10, 11), dtype='uint8')
Expand All @@ -733,7 +733,7 @@ def test_palettize_raster_no_alpha_layer(self, get_color_map_mock, image_mock):
@patch('hybig.browse.get_color_map_from_image')
def test_palettize_raster_with_alpha_layer(self, get_color_map_mock, image_mock):
"""Test that the quantize function is called by a correct image."""
raster = self.random.integers(255, dtype='uint8', size=(4, 10, 11))
raster = self.random.integers(255, size=(4, 10, 11), dtype='uint8')
# No transparent pixels
raster[3, :, :] = 255

Expand Down

0 comments on commit 189ed21

Please sign in to comment.