forked from OSGeo/gdal
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdriver_algorithms.py
executable file
·33 lines (25 loc) · 1.04 KB
/
driver_algorithms.py
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
28
29
30
31
32
33
#!/usr/bin/env pytest
# -*- coding: utf-8 -*-
###############################################################################
# Project: GDAL/OGR Test Suite
# Purpose: Check that drivers that declare algorithms actually implement them
# Author: Even Rouault <even dot rouault @ spatialys.com>
#
###############################################################################
# Copyright (c) 2025, Even Rouault <even dot rouault at spatialys.com>
#
# SPDX-License-Identifier: MIT
###############################################################################
from osgeo import gdal
def check(alg, expected_name):
assert alg.GetName() == expected_name
if alg.HasSubAlgorithms():
for subalg_name in alg.GetSubAlgorithmNames():
subalg = alg[subalg_name]
assert subalg, subalg_name
check(subalg, subalg_name)
assert alg.InstantiateSubAlgorithm("i_do_not_exist") is None
def test_driver_algorithms():
alg = gdal.GetGlobalAlgorithmRegistry()["driver"]
if alg:
check(alg, "driver")