]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/db/update/postcode.feature
Merge pull request #3409 from lonvia/docs-secondary-importance
[nominatim.git] / test / bdd / db / update / postcode.feature
1 @DB
2 Feature: Update of postcode
3     Tests for updating of data related to postcodes
4
5     Scenario: A new postcode appears in the postcode and word table
6         Given the places
7            | osm | class | type  | addr+postcode | addr+housenumber | geometry |
8            | N34 | place | house | 01982         | 111              |country:de |
9         When importing
10         Then location_postcode contains exactly
11            | country | postcode | geometry |
12            | de      | 01982    | country:de |
13         When updating places
14            | osm | class | type  | addr+postcode | addr+housenumber | geometry |
15            | N35 | place | house | 4567          | 5                |country:ch |
16         And updating postcodes
17         Then location_postcode contains exactly
18            | country | postcode | geometry |
19            | de      | 01982    | country:de |
20            | ch      | 4567     | country:ch |
21         And there are word tokens for postcodes 01982,4567
22
23      Scenario: When the last postcode is deleted, it is deleted from postcode and word
24         Given the places
25            | osm | class | type  | addr+postcode | addr+housenumber | geometry |
26            | N34 | place | house | 01982         | 111              |country:de |
27            | N35 | place | house | 4567          | 5                |country:ch |
28         When importing
29         And marking for delete N34
30         And updating postcodes
31         Then location_postcode contains exactly
32            | country | postcode | geometry |
33            | ch      | 4567     | country:ch |
34         And there are word tokens for postcodes 4567
35         And there are no word tokens for postcodes 01982
36
37      Scenario: A postcode is not deleted from postcode and word when it exist in another country
38         Given the places
39            | osm | class | type  | addr+postcode | addr+housenumber | geometry |
40            | N34 | place | house | 01982         | 111              |country:de |
41            | N35 | place | house | 01982         | 5                |country:fr |
42         When importing
43         And marking for delete N34
44         And updating postcodes
45         Then location_postcode contains exactly
46            | country | postcode | geometry |
47            | fr      | 01982    | country:fr |
48         And there are word tokens for postcodes 01982
49
50      Scenario: Updating a postcode is reflected in postcode table
51         Given the places
52            | osm | class | type     | addr+postcode |  geometry |
53            | N34 | place | postcode | 01982         | country:de |
54         When importing
55         And updating places
56            | osm | class | type     | addr+postcode |  geometry |
57            | N34 | place | postcode | 20453         | country:de |
58         And updating postcodes
59         Then location_postcode contains exactly
60            | country | postcode | geometry |
61            | de      | 20453    | country:de |
62         And there are word tokens for postcodes 20453
63
64      Scenario: When changing from a postcode type, the entry appears in placex
65         When importing
66         And updating places
67            | osm | class | type     | addr+postcode |  geometry |
68            | N34 | place | postcode | 01982         | country:de |
69         Then placex has no entry for N34
70         When updating places
71            | osm | class | type  | addr+postcode | housenr |  geometry |
72            | N34 | place | house | 20453         | 1       | country:de |
73         Then placex contains
74            | object | addr+housenumber | geometry |
75            | N34    | 1                | country:de|
76         And place contains exactly
77            | object | class | type  |
78            | N34    | place | house |
79         When updating postcodes
80         Then location_postcode contains exactly
81            | country | postcode | geometry |
82            | de      | 20453    | country:de |
83         And there are word tokens for postcodes 20453
84
85      Scenario: When changing to a postcode type, the entry disappears from placex
86         When importing
87         And updating places
88            | osm | class | type  | addr+postcode | housenr |  geometry |
89            | N34 | place | house | 20453         | 1       | country:de |
90         Then placex contains
91            | object | addr+housenumber | geometry |
92            | N34    | 1                | country:de|
93         When updating places
94            | osm | class | type     | addr+postcode |  geometry |
95            | N34 | place | postcode | 01982         | country:de |
96         Then placex has no entry for N34
97         And place contains exactly
98            | object | class | type     |
99            | N34    | place | postcode |
100         When updating postcodes
101         Then location_postcode contains exactly
102            | country | postcode | geometry |
103            | de      | 01982    | country:de |
104         And there are word tokens for postcodes 01982
105
106     Scenario: When a parent is deleted, the postcode gets a new parent
107         Given the grid with origin DE
108            | 1 |   | 3 | 4 |
109            |   | 9 |   |   |
110            | 2 |   | 5 | 6 |
111         Given the places
112            | osm | class    | type           | name  | admin | geometry    |
113            | R1  | boundary | administrative | Big   | 6     | (1,4,6,2,1) |
114            | R2  | boundary | administrative | Small | 6     | (1,3,5,2,1) |
115         Given the named places
116            | osm | class | type     | addr+postcode | geometry |
117            | N9  | place | postcode | 12345         | 9        |
118         When importing
119         And updating postcodes
120         Then location_postcode contains exactly
121            | country | postcode | geometry | parent_place_id |
122            | de      | 12345    | 9        | R2              |
123         When marking for delete R2
124         Then location_postcode contains exactly
125            | country | postcode | geometry | parent_place_id |
126            | de      | 12345    | 9        | R1              |