implement BDD osm2pgsql tests with pytest-bdd

This commit is contained in:
Sarah Hoffmann
2025-03-31 09:39:01 +02:00
parent 0f725b1880
commit fb440f29a2
18 changed files with 2409 additions and 17 deletions

View File

@@ -0,0 +1,135 @@
Feature: Updates of address interpolation objects
Test that changes to address interpolation objects are correctly
propagated.
Background:
Given the grid
| 1 | 2 |
Scenario: Adding a new interpolation
When loading osm data
"""
n1 Taddr:housenumber=3
n2 Taddr:housenumber=17
w33 Thighway=residential,name=Tao Nn1,n2
"""
Then place contains
| object | class | type |
| N1 | place | house |
| N2 | place | house |
When updating osm data
"""
w99 Taddr:interpolation=odd Nn1,n2
"""
Then place contains
| object | class | type |
| N1 | place | house |
| N2 | place | house |
| W99 | place | houses |
When indexing
Then placex contains exactly
| object | class | type |
| N1 | place | house |
| N2 | place | house |
| W33 | highway | residential |
Then location_property_osmline contains exactly
| osm_id | startnumber |
| 99 | 5 |
Scenario: Delete an existing interpolation
When loading osm data
"""
n1 Taddr:housenumber=2
n2 Taddr:housenumber=7
w99 Taddr:interpolation=odd Nn1,n2
"""
Then place contains
| object | class | type |
| N1 | place | house |
| N2 | place | house |
| W99 | place | houses |
When updating osm data
"""
w99 v2 dD
"""
Then place contains
| object | class | type |
| N1 | place | house |
| N2 | place | house |
When indexing
Then placex contains exactly
| object | class | type |
| N1 | place | house |
| N2 | place | house |
Then location_property_osmline contains exactly
| osm_id |
Scenario: Changing an object to an interpolation
When loading osm data
"""
n1 Taddr:housenumber=3
n2 Taddr:housenumber=17
w33 Thighway=residential Nn1,n2
w99 Thighway=residential Nn1,n2
"""
Then place contains
| object | class | type |
| N1 | place | house |
| N2 | place | house |
| W99 | highway | residential |
When updating osm data
"""
w99 Taddr:interpolation=odd Nn1,n2
"""
Then place contains
| object | class | type |
| N1 | place | house |
| N2 | place | house |
| W99 | place | houses |
When indexing
Then placex contains exactly
| object | class | type |
| N1 | place | house |
| N2 | place | house |
| W33 | highway | residential |
And location_property_osmline contains exactly
| osm_id | startnumber |
| 99 | 5 |
Scenario: Changing an interpolation to something else
When loading osm data
"""
n1 Taddr:housenumber=3
n2 Taddr:housenumber=17
w99 Taddr:interpolation=odd Nn1,n2
"""
Then place contains
| object | class | type |
| N1 | place | house |
| N2 | place | house |
| W99 | place | houses |
When updating osm data
"""
w99 Thighway=residential Nn1,n2
"""
Then place contains
| object | class | type |
| N1 | place | house |
| N2 | place | house |
| W99 | highway | residential |
When indexing
Then placex contains exactly
| object | class | type |
| N1 | place | house |
| N2 | place | house |
| W99 | highway | residential |
And location_property_osmline contains exactly
| osm_id |