mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-14 18:37:58 +00:00
add BDD tests for importing into the new place_entrance table
This commit is contained in:
@@ -953,7 +953,7 @@ function module.set_entrance_filter(data)
|
|||||||
|
|
||||||
ENTRANCE_FUNCTION = data and data.func
|
ENTRANCE_FUNCTION = data and data.func
|
||||||
|
|
||||||
if data.main_tags ~= nil and next(data.main_tags) ~= nil then
|
if data ~= nil and data.main_tags ~= nil and next(data.main_tags) ~= nil then
|
||||||
if data.extra_include ~= nil and next(data.extra_include) == nil then
|
if data.extra_include ~= nil and next(data.extra_include) == nil then
|
||||||
-- shortcut: no extra tags requested
|
-- shortcut: no extra tags requested
|
||||||
ENTRANCE_FUNCTION = function(o)
|
ENTRANCE_FUNCTION = function(o)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ Feature: Querying fo postcode variants
|
|||||||
| 10 | | | | 11 |
|
| 10 | | | | 11 |
|
||||||
And the places
|
And the places
|
||||||
| osm | class | type | name | addr+postcode | geometry |
|
| osm | class | type | name | addr+postcode | geometry |
|
||||||
| W1 | highway | path | De Weide | 3993 DX | 10,11 |
|
| W1 | highway | path | De Weide | <postcode> | 10,11 |
|
||||||
When importing
|
When importing
|
||||||
When geocoding "3993 DX"
|
When geocoding "3993 DX"
|
||||||
Then result 0 contains
|
Then result 0 contains
|
||||||
|
|||||||
124
test/bdd/features/osm2pgsql/import/entrances.feature
Normal file
124
test/bdd/features/osm2pgsql/import/entrances.feature
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
Feature: Import of entrance objects by osm2pgsql
|
||||||
|
Testing of correct setup of the entrance table
|
||||||
|
|
||||||
|
Scenario: Import simple entrance
|
||||||
|
When loading osm data
|
||||||
|
"""
|
||||||
|
n1 Tshop=sweets,entrance=yes,access=public x4.5 y-4
|
||||||
|
n2 Trouting:entrance=main x66.1 y0.1
|
||||||
|
n3 Tentrance=main,routing:entrance=foot x1 y2
|
||||||
|
n4 Thighway=bus_stop
|
||||||
|
"""
|
||||||
|
Then place contains exactly
|
||||||
|
| object | class | type |
|
||||||
|
| N1 | shop | sweets |
|
||||||
|
| N4 | highway | bus_stop |
|
||||||
|
And place_entrance contains exactly
|
||||||
|
| osm_id | type | extratags!dict | geometry!wkt |
|
||||||
|
| 1 | yes | 'shop': 'sweets', 'access': 'public' | 4.5 -4 |
|
||||||
|
| 2 | main | - | 66.1 0.1 |
|
||||||
|
| 3 | main | - | 1 2 |
|
||||||
|
|
||||||
|
Scenario: Addresses and entrance information can exist on the same node
|
||||||
|
When loading osm data
|
||||||
|
"""
|
||||||
|
n1 Taddr:housenumber=10,addr:street=North,entrance=main
|
||||||
|
"""
|
||||||
|
Then place contains exactly
|
||||||
|
| object | class | type | address+housenumber |
|
||||||
|
| N1 | place | house | 10 |
|
||||||
|
And place_entrance contains exactly
|
||||||
|
| osm_id | type |
|
||||||
|
| 1 | main |
|
||||||
|
Scenario Outline: Entrance import can be disabled
|
||||||
|
Given the lua style file
|
||||||
|
"""
|
||||||
|
local flex = require('import-full')
|
||||||
|
flex.set_entrance_filter<param>
|
||||||
|
"""
|
||||||
|
When loading osm data
|
||||||
|
"""
|
||||||
|
n1 Tentrance=yes,access=public
|
||||||
|
n2 Trouting:entrance=main
|
||||||
|
"""
|
||||||
|
Then place contains exactly
|
||||||
|
| object |
|
||||||
|
And place_entrance contains exactly
|
||||||
|
| osm_id |
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
| param |
|
||||||
|
| () |
|
||||||
|
| (nil) |
|
||||||
|
| {} |
|
||||||
|
| {include={'access'}} |
|
||||||
|
| {main_tags={}} |
|
||||||
|
|
||||||
|
Scenario: Entrance import can have custom main tags
|
||||||
|
Given the lua style file
|
||||||
|
"""
|
||||||
|
local flex = require('import-full')
|
||||||
|
flex.set_entrance_filter{main_tags = {'door'}}
|
||||||
|
"""
|
||||||
|
When loading osm data
|
||||||
|
"""
|
||||||
|
n1 Tentrance=yes,access=public
|
||||||
|
n2 Tdoor=foot,entrance=yes
|
||||||
|
"""
|
||||||
|
Then place contains exactly
|
||||||
|
| object |
|
||||||
|
And place_entrance contains exactly
|
||||||
|
| osm_id | type | extratags!dict |
|
||||||
|
| 2 | foot | 'entrance': 'yes' |
|
||||||
|
|
||||||
|
Scenario: Entrance import can have custom extra tags included
|
||||||
|
Given the lua style file
|
||||||
|
"""
|
||||||
|
local flex = require('import-full')
|
||||||
|
flex.set_entrance_filter{main_tags = {'entrance'},
|
||||||
|
extra_include = {'access'}}
|
||||||
|
"""
|
||||||
|
When loading osm data
|
||||||
|
"""
|
||||||
|
n1 Tentrance=yes,access=public,shop=newspaper
|
||||||
|
n2 Tentrance=yes,shop=sweets
|
||||||
|
"""
|
||||||
|
Then place_entrance contains exactly
|
||||||
|
| osm_id | type | extratags!dict |
|
||||||
|
| 1 | yes | 'access': 'public' |
|
||||||
|
| 2 | yes | - |
|
||||||
|
|
||||||
|
Scenario: Entrance import can have custom extra tags excluded
|
||||||
|
Given the lua style file
|
||||||
|
"""
|
||||||
|
local flex = require('import-full')
|
||||||
|
flex.set_entrance_filter{main_tags = {'entrance', 'door'},
|
||||||
|
extra_exclude = {'shop'}}
|
||||||
|
"""
|
||||||
|
When loading osm data
|
||||||
|
"""
|
||||||
|
n1 Tentrance=yes,access=public,shop=newspaper
|
||||||
|
n2 Tentrance=yes,door=yes,shop=sweets
|
||||||
|
"""
|
||||||
|
Then place_entrance contains exactly
|
||||||
|
| osm_id | type | extratags!dict |
|
||||||
|
| 1 | yes | 'access': 'public' |
|
||||||
|
| 2 | yes | - |
|
||||||
|
|
||||||
|
Scenario: Entrance import can have a custom function
|
||||||
|
Given the lua style file
|
||||||
|
"""
|
||||||
|
local flex = require('import-full')
|
||||||
|
flex.set_entrance_filter{func = function(object)
|
||||||
|
return {entrance='always', extratags = {ref = '1'}}
|
||||||
|
end}
|
||||||
|
"""
|
||||||
|
When loading osm data
|
||||||
|
"""
|
||||||
|
n1 Tentrance=yes,access=public,shop=newspaper
|
||||||
|
n2 Tshop=sweets
|
||||||
|
"""
|
||||||
|
Then place_entrance contains exactly
|
||||||
|
| osm_id | type | extratags!dict |
|
||||||
|
| 1 | always | 'ref': '1' |
|
||||||
|
| 2 | always | 'ref': '1' |
|
||||||
106
test/bdd/features/osm2pgsql/update/entrances.feature
Normal file
106
test/bdd/features/osm2pgsql/update/entrances.feature
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
Feature: Update of entrance objects by osm2pgsql
|
||||||
|
Testing of correct update of the entrance table
|
||||||
|
|
||||||
|
Scenario: A new entrance is added
|
||||||
|
When loading osm data
|
||||||
|
"""
|
||||||
|
n1 Tshop=shoes
|
||||||
|
"""
|
||||||
|
Then place_entrance contains exactly
|
||||||
|
| osm_id |
|
||||||
|
When updating osm data
|
||||||
|
"""
|
||||||
|
n2 Tentrance=yes
|
||||||
|
"""
|
||||||
|
Then place_entrance contains exactly
|
||||||
|
| osm_id | type |
|
||||||
|
| 2 | yes |
|
||||||
|
|
||||||
|
Scenario: An existing entrance is deleted
|
||||||
|
When loading osm data
|
||||||
|
"""
|
||||||
|
n1 Tentrance=yes
|
||||||
|
"""
|
||||||
|
Then place_entrance contains exactly
|
||||||
|
| osm_id | type |
|
||||||
|
| 1 | yes |
|
||||||
|
When updating osm data
|
||||||
|
"""
|
||||||
|
n1 dD
|
||||||
|
"""
|
||||||
|
Then place_entrance contains exactly
|
||||||
|
| osm_id |
|
||||||
|
|
||||||
|
Scenario: An existing node becomes an entrance
|
||||||
|
When loading osm data
|
||||||
|
"""
|
||||||
|
n1 Tshop=sweets
|
||||||
|
"""
|
||||||
|
Then place_entrance contains exactly
|
||||||
|
| osm_id | type |
|
||||||
|
And place contains exactly
|
||||||
|
| object | class |
|
||||||
|
| N1 | shop |
|
||||||
|
When updating osm data
|
||||||
|
"""
|
||||||
|
n1 Tshop=sweets,entrance=yes
|
||||||
|
"""
|
||||||
|
Then place_entrance contains exactly
|
||||||
|
| osm_id | type |
|
||||||
|
| 1 | yes |
|
||||||
|
And place contains exactly
|
||||||
|
| object | class |
|
||||||
|
| N1 | shop |
|
||||||
|
|
||||||
|
Scenario: An existing entrance tag is removed
|
||||||
|
When loading osm data
|
||||||
|
"""
|
||||||
|
n1 Tshop=sweets,entrance=yes
|
||||||
|
"""
|
||||||
|
Then place_entrance contains exactly
|
||||||
|
| osm_id | type |
|
||||||
|
| 1 | yes |
|
||||||
|
And place contains exactly
|
||||||
|
| object | class |
|
||||||
|
| N1 | shop |
|
||||||
|
When updating osm data
|
||||||
|
"""
|
||||||
|
n1 Tshop=sweets
|
||||||
|
"""
|
||||||
|
Then place_entrance contains exactly
|
||||||
|
| osm_id | type |
|
||||||
|
And place contains exactly
|
||||||
|
| object | class |
|
||||||
|
| N1 | shop |
|
||||||
|
|
||||||
|
Scenario: Extratags are added to an entrance
|
||||||
|
When loading osm data
|
||||||
|
"""
|
||||||
|
n1 Tentrance=yes
|
||||||
|
"""
|
||||||
|
Then place_entrance contains exactly
|
||||||
|
| osm_id | type | extratags |
|
||||||
|
| 1 | yes | - |
|
||||||
|
When updating osm data
|
||||||
|
"""
|
||||||
|
n1 Tentrance=yes,access=yes
|
||||||
|
"""
|
||||||
|
Then place_entrance contains exactly
|
||||||
|
| osm_id | type | extratags!dict |
|
||||||
|
| 1 | yes | 'access': 'yes' |
|
||||||
|
|
||||||
|
Scenario: Extratags are deleted from an entrance
|
||||||
|
When loading osm data
|
||||||
|
"""
|
||||||
|
n1 Tentrance=yes,access=yes
|
||||||
|
"""
|
||||||
|
Then place_entrance contains exactly
|
||||||
|
| osm_id | type | extratags!dict |
|
||||||
|
| 1 | yes | 'access': 'yes' |
|
||||||
|
When updating osm data
|
||||||
|
"""
|
||||||
|
n1 Tentrance=yes
|
||||||
|
"""
|
||||||
|
Then place_entrance contains exactly
|
||||||
|
| osm_id | type | extratags |
|
||||||
|
| 1 | yes | - |
|
||||||
Reference in New Issue
Block a user