File: test_gdal.py

package info (click to toggle)
python-imageio 2.37.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,016 kB
  • sloc: python: 26,044; makefile: 138
file content (27 lines) | stat: -rw-r--r-- 603 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
""" Test gdal plugin functionality.
"""

import pytest
import imageio

pytest.importorskip("osgeo", reason="gdal is not installed")


def test_gdal_reading(test_images):
    """Test reading gdal"""

    filename = test_images / "geotiff.tif"

    im = imageio.imread(filename, "gdal")
    assert im.shape == (929, 699)

    R = imageio.read(filename, "gdal")
    assert R.format.name == "GDAL"
    meta_data = R.get_meta_data()
    assert "TIFFTAG_XRESOLUTION" in meta_data

    # Fail
    with pytest.raises(IndexError):
        R.get_data(-1)
    with pytest.raises(IndexError):
        R.get_data(3)