Syntax highlighting for processing tests readme

This commit is contained in:
Matthias Kuhn 2016-03-01 08:17:46 +01:00
parent e695fbb9f1
commit 9b9c692be2

View File

@ -7,7 +7,8 @@ This file is structured with [yaml syntax](http://www.yaml.org/start.html).
A basic test appears under the toplevel key `tests` and looks like this: A basic test appears under the toplevel key `tests` and looks like this:
- name: centroid ```yaml
- name: centroid
algorithm: qgis:polygoncentroids algorithm: qgis:polygoncentroids
params: params:
- type: vector - type: vector
@ -16,6 +17,7 @@ A basic test appears under the toplevel key `tests` and looks like this:
OUTPUT_LAYER: OUTPUT_LAYER:
type: vector type: vector
name: expected/polys_centroid.gml name: expected/polys_centroid.gml
```
How To How To
------ ------
@ -39,7 +41,8 @@ ones to params and the last one(s) to results.
The above translates to The above translates to
- name: densify ```yaml
- name: densify
algorithm: qgis:densifygeometriesgivenaninterval algorithm: qgis:densifygeometriesgivenaninterval
params: params:
- type: vector - type: vector
@ -49,6 +52,7 @@ The above translates to
OUTPUT: OUTPUT:
type: vector type: vector
name: expected/polys_densify.gml name: expected/polys_densify.gml
```
Params and results Params and results
------------------ ------------------
@ -57,17 +61,21 @@ Params and results
Params and results are specified as lists or dictionaries: Params and results are specified as lists or dictionaries:
params: ```yaml
params:
INTERVAL: 5 INTERVAL: 5
INTERPOLATE: True INTERPOLATE: True
NAME: A processing test NAME: A processing test
```
or or
params: ```yaml
params:
- 2 - 2
- string - string
- another param - another param
```
### Layer type parameters ### Layer type parameters
@ -80,13 +88,15 @@ You will often need to specify layers as parameters. To specify a layer you will
This is what it looks like in action: This is what it looks like in action:
params: ```yaml
params:
PAR: 2 PAR: 2
STR: string STR: string
LAYER: LAYER:
type: vector type: vector
name: polys.gml name: polys.gml
OTHER: another param OTHER: another param
```
### Results ### Results
@ -96,9 +106,11 @@ Results are specified very similar.
It couldn't be more trivial It couldn't be more trivial
```yaml
OUTPUT: OUTPUT:
name: expected/qgis_intersection.gml name: expected/qgis_intersection.gml
type: vector type: vector
```
#### Vector with tolerance #### Vector with tolerance
@ -114,7 +126,8 @@ field name `__all__` which will apply a certain tolerance to all fields.
There is another property `geometry` which also accepts a `precision` which is There is another property `geometry` which also accepts a `precision` which is
applied to each vertex. applied to each vertex.
OUTPUT: ```yaml
OUTPUT:
type: vector type: vector
name: expected/abcd.gml name: expected/abcd.gml
compare: compare:
@ -124,31 +137,38 @@ applied to each vertex.
A: skip # skip field A A: skip # skip field A
geometry: geometry:
precision: 5 # compare coordinates with a precision of 5 digits precision: 5 # compare coordinates with a precision of 5 digits
```
#### Raster files #### Raster files
Raster files are compared with a hash checksum. This is calculated when you create Raster files are compared with a hash checksum. This is calculated when you create
a test from the processing history. a test from the processing history.
OUTPUT: ```yaml
OUTPUT:
type: rasterhash type: rasterhash
hash: f1fedeb6782f9389cf43590d4c85ada9155ab61fef6dc285aaeb54d6 hash: f1fedeb6782f9389cf43590d4c85ada9155ab61fef6dc285aaeb54d6
```
#### Files #### Files
You can compare the content of an ouptut file by an expected result reference file You can compare the content of an ouptut file by an expected result reference file
OUTPUT_HTML_FILE: ```yaml
OUTPUT_HTML_FILE:
name: expected/basic_statistics_string.html name: expected/basic_statistics_string.html
type: file type: file
```
Or you can use one or more regular expressions that will be [matched](https://docs.python.org/2/library/re.html#re.search) against the file Or you can use one or more regular expressions that will be [matched](https://docs.python.org/2/library/re.html#re.search) against the file
content content
OUTPUT: ```yaml
OUTPUT:
name: layer_info.html name: layer_info.html
type: regex type: regex
rules: rules:
- 'Extent: \(-1.000000, -3.000000\) - \(11.000000, 5.000000\)' - 'Extent: \(-1.000000, -3.000000\) - \(11.000000, 5.000000\)'
- 'Geometry: Line String' - 'Geometry: Line String'
- 'Feature Count: 6' - 'Feature Count: 6'
```