Skip to content

Commit

Permalink
cog.py: Fix test_cog_creation_of_overviews_with_compression.
Browse files Browse the repository at this point in the history
- The second overview check of JPEG_QUALITY: a -> b.
- Use with to make the code more obvious / simplify cleanup.
  • Loading branch information
schwehr committed Jan 23, 2025
1 parent ae464d4 commit 6aa72f2
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions autotest/gcore/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,16 +322,14 @@ def test_cog_creation_of_overviews_with_compression():
assert ds.GetRasterBand(1).GetOverviewCount() == 2
assert ds.GetMetadata("IMAGE_STRUCTURE")["COMPRESSION"] == "LZW"

ds_overview_a = gdal.Open("GTIFF_DIR:2:" + filename)
assert ds_overview_a.GetMetadata("IMAGE_STRUCTURE")["COMPRESSION"] == "JPEG"
assert ds_overview_a.GetMetadata("IMAGE_STRUCTURE")["JPEG_QUALITY"] == "50"
with gdal.Open("GTIFF_DIR:2:" + filename) as ds_overview:
assert ds_overview.GetMetadata("IMAGE_STRUCTURE")["COMPRESSION"] == "JPEG"
assert ds_overview.GetMetadata("IMAGE_STRUCTURE")["JPEG_QUALITY"] == "50"

ds_overview_b = gdal.Open("GTIFF_DIR:3:" + filename)
assert ds_overview_b.GetMetadata("IMAGE_STRUCTURE")["COMPRESSION"] == "JPEG"
assert ds_overview_a.GetMetadata("IMAGE_STRUCTURE")["JPEG_QUALITY"] == "50"
with gdal.Open("GTIFF_DIR:3:" + filename) as ds_overview:
assert ds_overview.GetMetadata("IMAGE_STRUCTURE")["COMPRESSION"] == "JPEG"
assert ds_overview.GetMetadata("IMAGE_STRUCTURE")["JPEG_QUALITY"] == "50"

ds_overview_a = None
ds_overview_b = None
ds = None

src_ds = None
Expand Down

0 comments on commit 6aa72f2

Please sign in to comment.