]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/db/query/postcodes.feature
Merge remote-tracking branch 'upstream/master'
[nominatim.git] / test / bdd / db / query / postcodes.feature
1 @DB
2 Feature: Querying fo postcode variants
3
4     Scenario: Postcodes in Singapore (6-digit postcode)
5         Given the grid with origin SG
6             | 10 |   |   |   | 11 |
7         And the places
8             | osm | class   | type | name   | addr+postcode | geometry |
9             | W1  | highway | path | Lorang | 399174        | 10,11    |
10         When importing
11         When sending search query "399174"
12         Then results contain
13             | ID | type     | display_name |
14             | 0  | postcode | 399174, Singapore |
15
16
17     @fail-legacy
18     Scenario Outline: Postcodes in the Netherlands (mixed postcode with spaces)
19         Given the grid with origin NL
20             | 10 |   |   |   | 11 |
21         And the places
22             | osm | class   | type | name     | addr+postcode | geometry |
23             | W1  | highway | path | De Weide | 3993 DX       | 10,11    |
24         When importing
25         When sending search query "3993 DX"
26         Then results contain
27             | ID | type     | display_name |
28             | 0  | postcode | 3993 DX, Nederland      |
29         When sending search query "3993dx"
30         Then results contain
31             | ID | type     | display_name |
32             | 0  | postcode | 3993 DX, Nederland      |
33
34         Examples:
35             | postcode |
36             | 3993 DX  |
37             | 3993DX   |
38             | 3993 dx  |
39
40
41     @fail-legacy
42     Scenario: Postcodes in Singapore (6-digit postcode)
43         Given the grid with origin SG
44             | 10 |   |   |   | 11 |
45         And the places
46             | osm | class   | type | name   | addr+postcode | geometry |
47             | W1  | highway | path | Lorang | 399174        | 10,11    |
48         When importing
49         When sending search query "399174"
50         Then results contain
51             | ID | type     | display_name |
52             | 0  | postcode | 399174, Singapore       |
53
54
55     @fail-legacy
56     Scenario Outline: Postcodes in Andorra (with country code)
57         Given the grid with origin AD
58             | 10 |   |   |   | 11 |
59         And the places
60             | osm | class   | type | name   | addr+postcode | geometry |
61             | W1  | highway | path | Lorang | <postcode>    | 10,11    |
62         When importing
63         When sending search query "675"
64         Then results contain
65             | ID | type     | display_name |
66             | 0  | postcode | AD675, Andorra |
67         When sending search query "AD675"
68         Then results contain
69             | ID | type     | display_name |
70             | 0  | postcode | AD675, Andorra |
71
72         Examples:
73             | postcode |
74             | 675      |
75             | AD 675   |
76             | AD675    |
77
78
79     @fail-legacy
80     Scenario: Different postcodes with the same normalization can both be found
81         Given the places
82            | osm | class | type  | addr+postcode | addr+housenumber | geometry |
83            | N34 | place | house | EH4 7EA       | 111              | country:gb |
84            | N35 | place | house | E4 7EA        | 111              | country:gb |
85         When importing
86         Then location_postcode contains exactly
87            | country | postcode | geometry |
88            | gb      | EH4 7EA  | country:gb |
89            | gb      | E4 7EA   | country:gb |
90         When sending search query "EH4 7EA"
91         Then results contain
92            | type     | display_name |
93            | postcode | EH4 7EA, United Kingdom |
94         When sending search query "E4 7EA"
95         Then results contain
96            | type     | display_name |
97            | postcode | E4 7EA, United Kingdom |
98
99
100     @fail-legacy
101     @v1-api-python-only
102     Scenario: Postcode areas are preferred over postcode points
103         Given the grid with origin DE
104             | 1 | 2 |
105             | 4 | 3 |
106         Given the places
107             | osm | class    | type        | postcode | geometry    |
108             | R23 | boundary | postal_code | 12345    | (1,2,3,4,1) |
109         When importing
110         Then location_postcode contains exactly
111           | country | postcode |
112           | de      | 12345    |
113         When sending search query "12345, de"
114         Then results contain
115           | osm |
116           | R23 |