@@ -569,34 +569,39 @@ def test_algorithm_mutual_dependencies(tmp_path):
569569 ):
570570 alg .Run ()
571571
572+
573+ def test_algorithm_mutual_dependency_group (tmp_path ):
574+
575+ reg = gdal .GetGlobalAlgorithmRegistry ()
576+
572577 # Check mutual dependency group
573578 alg = reg ["raster" ]["scale" ]
574579
575580 usage = json .loads (alg .GetUsageAsJSON ())
576- src_min = [a for a in usage ["input_arguments" ] if a ["name" ] == "src -min" ][0 ]
577- src_max = [a for a in usage ["input_arguments" ] if a ["name" ] == "src -max" ][0 ]
578- dst_min = [a for a in usage ["input_arguments" ] if a ["name" ] == "dst -min" ][0 ]
579- dst_max = [a for a in usage ["input_arguments" ] if a ["name" ] == "dst -max" ][0 ]
580-
581- assert src_min ["mutual_dependency_group" ] == "src -max-min"
582- assert src_max ["mutual_dependency_group" ] == "src -max-min"
583- assert dst_min ["mutual_dependency_group" ] == "dst -max-min"
584- assert dst_max ["mutual_dependency_group" ] == "dst -max-min"
585-
586- src_min_arg = alg .GetArg ("src -min" )
587- src_max_arg = alg .GetArg ("src -max" )
588- dst_min_arg = alg .GetArg ("dst -min" )
589- dst_max_arg = alg .GetArg ("dst -max" )
590-
591- assert src_min_arg .GetMutualDependencyGroup () == "src -max-min"
592- assert src_max_arg .GetMutualDependencyGroup () == "src -max-min"
593- assert dst_min_arg .GetMutualDependencyGroup () == "dst -max-min"
594- assert dst_max_arg .GetMutualDependencyGroup () == "dst -max-min"
595-
596- assert src_min ["depends_on" ] == ["src -max" ]
597- assert src_max ["depends_on" ] == ["src -min" ]
598- assert dst_min ["depends_on" ] == ["dst -max" ]
599- assert dst_max ["depends_on" ] == ["dst -min" ]
581+ src_min = [a for a in usage ["input_arguments" ] if a ["name" ] == "input -min" ][0 ]
582+ src_max = [a for a in usage ["input_arguments" ] if a ["name" ] == "input -max" ][0 ]
583+ dst_min = [a for a in usage ["input_arguments" ] if a ["name" ] == "output -min" ][0 ]
584+ dst_max = [a for a in usage ["input_arguments" ] if a ["name" ] == "output -max" ][0 ]
585+
586+ assert src_min ["mutual_dependency_group" ] == "input -max-min"
587+ assert src_max ["mutual_dependency_group" ] == "input -max-min"
588+ assert dst_min ["mutual_dependency_group" ] == "output -max-min"
589+ assert dst_max ["mutual_dependency_group" ] == "output -max-min"
590+
591+ src_min_arg = alg .GetArg ("input -min" )
592+ src_max_arg = alg .GetArg ("input -max" )
593+ dst_min_arg = alg .GetArg ("output -min" )
594+ dst_max_arg = alg .GetArg ("output -max" )
595+
596+ assert src_min_arg .GetMutualDependencyGroup () == "input -max-min"
597+ assert src_max_arg .GetMutualDependencyGroup () == "input -max-min"
598+ assert dst_min_arg .GetMutualDependencyGroup () == "output -max-min"
599+ assert dst_max_arg .GetMutualDependencyGroup () == "output -max-min"
600+
601+ assert src_min ["depends_on" ] == ["input -max" ]
602+ assert src_max ["depends_on" ] == ["input -min" ]
603+ assert dst_min ["depends_on" ] == ["output -max" ]
604+ assert dst_max ["depends_on" ] == ["output -min" ]
600605
601606 # This does not include mutual dependencies
602607 assert src_min_arg .GetDirectDependencies () is None
@@ -605,26 +610,26 @@ def test_algorithm_mutual_dependencies(tmp_path):
605610 assert dst_max_arg .GetDirectDependencies () is None
606611
607612 # This includes both direct and mutual dependencies
608- assert alg .GetArgDependencies ("src -max" ) == ["src -min" ]
609- assert alg .GetArgDependencies ("src -min" ) == ["src -max" ]
610- assert alg .GetArgDependencies ("dst -min" ) == ["dst -max" ]
611- assert alg .GetArgDependencies ("dst -max" ) == ["dst -min" ]
613+ assert alg .GetArgDependencies ("input -max" ) == ["input -min" ]
614+ assert alg .GetArgDependencies ("input -min" ) == ["input -max" ]
615+ assert alg .GetArgDependencies ("output -min" ) == ["output -max" ]
616+ assert alg .GetArgDependencies ("output -max" ) == ["output -min" ]
612617
613- alg ["src -min" ] = 1
618+ alg ["input -min" ] = 1
614619 alg ["output" ] = str (tmp_path / "out.tif" )
615620 alg ["input" ] = "data/byte.tif"
616621 with pytest .raises (
617622 RuntimeError ,
618- match = r"Argument\(s\) 'src -min' require\(s\) that the following argument\(s\) are also specified: src -max." ,
623+ match = r"Argument\(s\) 'input -min' require\(s\) that the following argument\(s\) are also specified: input -max." ,
619624 ):
620625 alg .Run ()
621626
622627 alg = reg ["raster" ]["scale" ]
623- alg ["src -max" ] = 10
628+ alg ["input -max" ] = 10
624629 alg ["input" ] = "data/byte.tif"
625630 alg ["output" ] = str (tmp_path / "out.tif" )
626631 with pytest .raises (
627632 RuntimeError ,
628- match = r"Argument\(s\) 'src -max' require\(s\) that the following argument\(s\) are also specified: src -min." ,
633+ match = r"Argument\(s\) 'input -max' require\(s\) that the following argument\(s\) are also specified: input -min." ,
629634 ):
630635 alg .Run ()
0 commit comments