@@ -353,9 +353,9 @@ def test_ogr_factory_7():
353353# Test forceTo()
354354
355355
356- def test_ogr_factory_8 ():
357-
358- tests = [
356+ @ pytest . mark . parametrize (
357+ "src_wkt,exp_wkt,target_type" ,
358+ [
359359 ("POINT (2 5)" , "POINT ZM (2 5 0 0)" , ogr .wkbPointZM ),
360360 ("POINT ZM (2 5 3 4)" , "POINT ZM (2 5 3 4)" , ogr .wkbPointZM ),
361361 ("POINT ZM (2 5 3 4)" , "MULTIPOINT ZM ((2 5 3 4))" , ogr .wkbMultiPointZM ),
@@ -866,23 +866,22 @@ def test_ogr_factory_8():
866866 ogr .wkbMultiCurve ,
867867 ),
868868 ("MULTIPOINT (2 5)" , "POINT(2 5)" , ogr .wkbPoint ),
869- ]
870- for (src_wkt , exp_wkt , target_type ) in tests :
869+ ],
870+ )
871+ def test_ogr_factory_force_to (src_wkt , exp_wkt , target_type ):
871872
872- src_geom = ogr .CreateGeometryFromWkt (src_wkt )
873- with gdal .config_option ("OGR_ARC_STEPSIZE" , "45" ):
874- dst_geom = ogr .ForceTo (src_geom , target_type )
875-
876- if exp_wkt is None :
877- exp_wkt = src_wkt
878- elif (
879- target_type != ogr .wkbUnknown and dst_geom .GetGeometryType () != target_type
880- ):
881- print (target_type )
882- print (dst_geom .ExportToIsoWkt ())
883- assert False , (src_wkt , exp_wkt , target_type )
873+ src_geom = ogr .CreateGeometryFromWkt (src_wkt )
874+ with gdal .config_option ("OGR_ARC_STEPSIZE" , "45" ):
875+ dst_geom = ogr .ForceTo (src_geom , target_type )
884876
885- ogrtest .check_feature_geometry (dst_geom , exp_wkt )
877+ if exp_wkt is None :
878+ exp_wkt = src_wkt
879+ elif target_type != ogr .wkbUnknown and dst_geom .GetGeometryType () != target_type :
880+ print (target_type )
881+ print (dst_geom .ExportToIsoWkt ())
882+ assert False , (src_wkt , exp_wkt , target_type )
883+
884+ ogrtest .check_feature_geometry (dst_geom , exp_wkt )
886885
887886
888887###############################################################################
0 commit comments