def identify_4(): dr = gdal.IdentifyDriverEx( 'data/byte.tif' ) if dr is None or dr.GetDescription() != 'GTiff': gdaltest.post_reason( 'Got wrong driver for byte.tif' ) return 'fail' dr = gdal.IdentifyDriverEx( 'data/byte.tif', gdal.OF_RASTER ) if dr is None or dr.GetDescription() != 'GTiff': gdaltest.post_reason( 'Got wrong driver for byte.tif' ) return 'fail' dr = gdal.IdentifyDriverEx( 'data/byte.tif', gdal.OF_VECTOR ) if dr is not None: gdaltest.post_reason( 'Got wrong driver for byte.tif' ) return 'fail' dr = gdal.IdentifyDriverEx( 'data/byte.tif', allowed_drivers = [ 'HFA' ] ) if dr is not None: gdaltest.post_reason( 'Got wrong driver for byte.tif' ) return 'fail' dr = gdal.IdentifyDriverEx( '../gdrivers/data/aea.dat', sibling_files = [ 'aea.dat'] ) if dr is not None: gdaltest.post_reason( 'Got a driver, which was not expected!' ) return 'fail' dr = gdal.IdentifyDriverEx( '../gdrivers/data/aea.dat', sibling_files = [ 'aea.dat', 'aea.hdr' ] ) if dr is None: gdaltest.post_reason( 'Did not get a driver!' ) return 'fail' return 'success'
def test_identify_4(): dr = gdal.IdentifyDriverEx('data/byte.tif') assert dr is not None and dr.GetDescription() == 'GTiff', \ 'Got wrong driver for byte.tif' dr = gdal.IdentifyDriverEx('data/byte.tif', gdal.OF_RASTER) assert dr is not None and dr.GetDescription() == 'GTiff', \ 'Got wrong driver for byte.tif' dr = gdal.IdentifyDriverEx('data/byte.tif', gdal.OF_VECTOR) assert dr is None, 'Got wrong driver for byte.tif' dr = gdal.IdentifyDriverEx('data/byte.tif', allowed_drivers=['HFA']) assert dr is None, 'Got wrong driver for byte.tif' dr = gdal.IdentifyDriverEx('../gdrivers/data/aea.dat', sibling_files=['aea.dat']) assert dr is None, 'Got a driver, which was not expected!' dr = gdal.IdentifyDriverEx('../gdrivers/data/aea.dat', sibling_files=['aea.dat', 'aea.hdr']) assert dr is not None, 'Did not get a driver!'