mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-04 00:04:25 -05:00 
			
		
		
		
	Merge pull request #4307 from ghtmtt/proc_tests
[processing] other qgis test, clean commit
This commit is contained in:
		
						commit
						aa021bef0c
					
				
							
								
								
									
										26
									
								
								python/plugins/processing/tests/testdata/expected/select_by_expression.gfs
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								python/plugins/processing/tests/testdata/expected/select_by_expression.gfs
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,26 @@
 | 
			
		||||
<GMLFeatureClassList>
 | 
			
		||||
  <GMLFeatureClass>
 | 
			
		||||
    <Name>select_by_expression</Name>
 | 
			
		||||
    <ElementPath>select_by_expression</ElementPath>
 | 
			
		||||
    <!--POINT-->
 | 
			
		||||
    <GeometryType>1</GeometryType>
 | 
			
		||||
    <SRSName>EPSG:4326</SRSName>
 | 
			
		||||
    <DatasetSpecificInfo>
 | 
			
		||||
      <FeatureCount>2</FeatureCount>
 | 
			
		||||
      <ExtentXMin>0.00000</ExtentXMin>
 | 
			
		||||
      <ExtentXMax>7.00000</ExtentXMax>
 | 
			
		||||
      <ExtentYMin>-1.00000</ExtentYMin>
 | 
			
		||||
      <ExtentYMax>-1.00000</ExtentYMax>
 | 
			
		||||
    </DatasetSpecificInfo>
 | 
			
		||||
    <PropertyDefn>
 | 
			
		||||
      <Name>id</Name>
 | 
			
		||||
      <ElementPath>id</ElementPath>
 | 
			
		||||
      <Type>Integer</Type>
 | 
			
		||||
    </PropertyDefn>
 | 
			
		||||
    <PropertyDefn>
 | 
			
		||||
      <Name>id2</Name>
 | 
			
		||||
      <ElementPath>id2</ElementPath>
 | 
			
		||||
      <Type>Integer</Type>
 | 
			
		||||
    </PropertyDefn>
 | 
			
		||||
  </GMLFeatureClass>
 | 
			
		||||
</GMLFeatureClassList>
 | 
			
		||||
							
								
								
									
										28
									
								
								python/plugins/processing/tests/testdata/expected/select_by_expression.gml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								python/plugins/processing/tests/testdata/expected/select_by_expression.gml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,28 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8" ?>
 | 
			
		||||
<ogr:FeatureCollection
 | 
			
		||||
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 | 
			
		||||
     xsi:schemaLocation=""
 | 
			
		||||
     xmlns:ogr="http://ogr.maptools.org/"
 | 
			
		||||
     xmlns:gml="http://www.opengis.net/gml">
 | 
			
		||||
  <gml:boundedBy>
 | 
			
		||||
    <gml:Box>
 | 
			
		||||
      <gml:coord><gml:X>0</gml:X><gml:Y>-1</gml:Y></gml:coord>
 | 
			
		||||
      <gml:coord><gml:X>7</gml:X><gml:Y>-1</gml:Y></gml:coord>
 | 
			
		||||
    </gml:Box>
 | 
			
		||||
  </gml:boundedBy>
 | 
			
		||||
 | 
			
		||||
  <gml:featureMember>
 | 
			
		||||
    <ogr:select_by_expression fid="points.8">
 | 
			
		||||
      <ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
 | 
			
		||||
      <ogr:id>9</ogr:id>
 | 
			
		||||
      <ogr:id2>0</ogr:id2>
 | 
			
		||||
    </ogr:select_by_expression>
 | 
			
		||||
  </gml:featureMember>
 | 
			
		||||
  <gml:featureMember>
 | 
			
		||||
    <ogr:select_by_expression fid="points.7">
 | 
			
		||||
      <ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>7,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
 | 
			
		||||
      <ogr:id>8</ogr:id>
 | 
			
		||||
      <ogr:id2>0</ogr:id2>
 | 
			
		||||
    </ogr:select_by_expression>
 | 
			
		||||
  </gml:featureMember>
 | 
			
		||||
</ogr:FeatureCollection>
 | 
			
		||||
@ -2555,3 +2555,34 @@ tests:
 | 
			
		||||
      OUTPUT_LAYER:
 | 
			
		||||
        name: expected/selected_points.gml
 | 
			
		||||
        type: vector
 | 
			
		||||
 | 
			
		||||
  - algorithm: script:selectbyexpression
 | 
			
		||||
    name: Select by expression
 | 
			
		||||
    params:
 | 
			
		||||
      INPUT_LAYER:
 | 
			
		||||
        name: points.gml
 | 
			
		||||
        type: vector
 | 
			
		||||
    results:
 | 
			
		||||
      OUTPUT_LAYER:
 | 
			
		||||
        name: expected/select_by_expression.gml
 | 
			
		||||
        type: vector
 | 
			
		||||
 | 
			
		||||
  - algorithm: qgis:randomextract
 | 
			
		||||
    name: Random extract by number
 | 
			
		||||
    params:
 | 
			
		||||
      INPUT:
 | 
			
		||||
        name: custom/points_weighted.gml
 | 
			
		||||
        type: vector
 | 
			
		||||
      METHOD: '0'
 | 
			
		||||
      NUMBER: 4
 | 
			
		||||
    results: {}
 | 
			
		||||
 | 
			
		||||
  - algorithm: qgis:randomextract
 | 
			
		||||
    name: Random extract by percentage 
 | 
			
		||||
    params:
 | 
			
		||||
      INPUT:
 | 
			
		||||
        name: custom/points_weighted.gml
 | 
			
		||||
        type: vector
 | 
			
		||||
      METHOD: '1'
 | 
			
		||||
      NUMBER: 50
 | 
			
		||||
    results: {}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										15
									
								
								python/plugins/processing/tests/testdata/scripts/selectbyexpression.py
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								python/plugins/processing/tests/testdata/scripts/selectbyexpression.py
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,15 @@
 | 
			
		||||
##Select by expression=name
 | 
			
		||||
##Tests=group
 | 
			
		||||
##INPUT_LAYER=vector
 | 
			
		||||
##OUTPUT_LAYER=output vector
 | 
			
		||||
 | 
			
		||||
import processing
 | 
			
		||||
 | 
			
		||||
result = processing.run("qgis:selectbyexpression",
 | 
			
		||||
                        INPUT_LAYER,
 | 
			
		||||
                        '"id2" = 0 and "id" > 7',
 | 
			
		||||
                        "1")
 | 
			
		||||
 | 
			
		||||
processing.run("qgis:saveselectedfeatures",
 | 
			
		||||
               result["RESULT"],
 | 
			
		||||
               OUTPUT_LAYER)
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user