Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding test coverage for RasterDataset.plot #430

Merged
merged 1 commit into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/data/raster/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def generate_test_data(fn: str) -> str:
}

with rasterio.open(fn, "w", **profile) as f:
f.write(np.random.randint(0, 2**32 - 1, size=(1, 4, 4)))
f.write(np.random.randint(0, 256, size=(1, 4, 4)))

md5: str = calculate_md5(fn)
return md5
Expand Down
Binary file modified tests/data/raster/test0.tif
Binary file not shown.
6 changes: 6 additions & 0 deletions tests/datasets/test_geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ def test_no_data(self, tmp_path: Path) -> None:
with pytest.raises(FileNotFoundError, match="No RasterDataset data was found"):
RasterDataset(str(tmp_path))

def test_plot_with_cmap(self, custom_dtype_ds: RasterDataset) -> None:
custom_dtype_ds.cmap = {i: (0, 0, 0, 255) for i in range(256)}
custom_dtype_ds.is_image = False
x = custom_dtype_ds[custom_dtype_ds.bounds]
custom_dtype_ds.plot(x["mask"])


class TestVectorDataset:
@pytest.fixture
Expand Down