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