2 Feature: Import of postcodes
 
   3     Tests for postcode estimation
 
   5     Scenario: Postcodes on the object are preferred over those on the address
 
   6         Given the scene admin-areas
 
   8             | osm | class    | type           | admin | addr+postcode | geometry |
 
   9             | R1  | boundary | administrative | 6     | 112           | :b0      |
 
  10             | R34 | boundary | administrative | 8     | 112 DE        | :b1:E    |
 
  11             | R4  | boundary | administrative | 10    | 112 DE 34     | :b2:N    |
 
  13             | osm | class    | type        | addr+postcode | geometry |
 
  14             | W93 | highway  | residential | 112 DE 344    | :w2N     |
 
  15             | W22 | building | yes         | 112 DE 344N   | :building:w2N |
 
  25     Scenario: Postcodes from a road are inherited by an attached building
 
  26         Given the scene admin-areas
 
  28             | osm | class    | type        | addr+postcode | geometry |
 
  29             | W93 | highway  | residential | 86034         | :w2N     |
 
  31             | osm | class    | type  | geometry |
 
  32             | W22 | building | yes   | :building:w2N |
 
  35             | object | postcode | parent_place_id |
 
  38     Scenario: Postcodes from the lowest admin area are inherited by ways
 
  39         Given the scene admin-areas
 
  41             | osm | class    | type           | admin | addr+postcode | geometry |
 
  42             | R1  | boundary | administrative | 6     | 112           | :b0      |
 
  43             | R34 | boundary | administrative | 8     | 112 DE        | :b1:E    |
 
  44             | R4  | boundary | administrative | 10    | 112 DE 34     | :b2:N    |
 
  46             | osm | class    | type           | geometry |
 
  47             | W93 | highway  | residential    | :w2N     |
 
  53     Scenario: Postcodes from the lowest admin area with postcode are inherited by ways
 
  54         Given the scene admin-areas
 
  56             | osm | class    | type           | admin | addr+postcode | geometry |
 
  57             | R1  | boundary | administrative | 6     | 112           | :b0      |
 
  58             | R34 | boundary | administrative | 8     | 112 DE        | :b1:E    |
 
  60             | osm | class    | type           | admin | geometry |
 
  61             | R4  | boundary | administrative | 10    | :b2:N    |
 
  63             | osm | class    | type           | geometry |
 
  64             | W93 | highway  | residential    | :w2N     |
 
  67             | object | postcode | parent_place_id |
 
  70     Scenario: Postcodes from the lowest admin area are inherited by buildings
 
  71         Given the scene admin-areas
 
  73             | osm | class    | type           | admin | addr+postcode | geometry |
 
  74             | R1  | boundary | administrative | 6     | 112           | :b0      |
 
  75             | R34 | boundary | administrative | 8     | 112 DE        | :b1:E    |
 
  76             | R4  | boundary | administrative | 10    | 112 DE 34     | :b2:N    |
 
  78             | osm | class    | type  | geometry |
 
  79             | W22 | building | yes   | :building:w2N |
 
  85     Scenario: Roads get postcodes from nearby named buildings without other info
 
  86         Given the scene admin-areas
 
  88             | osm | class    | type           | geometry |
 
  89             | W93 | highway  | residential    | :w2N     |
 
  91             | osm | class    | type        | addr+postcode | geometry |
 
  92             | W22 | building | yes         | 445023        | :building:w2N |
 
  98     Scenario: Roads get postcodes from nearby unnamed buildings without other info
 
  99         Given the scene admin-areas
 
 101             | osm | class    | type           | geometry |
 
 102             | W93 | highway  | residential    | :w2N     |
 
 104             | osm | class    | type        | addr+postcode | geometry |
 
 105             | W22 | place    | postcode    | 445023        | :building:w2N |
 
 108             | object | postcode |
 
 111     Scenario: Postcodes from admin boundaries are preferred over estimated postcodes
 
 112         Given the scene admin-areas
 
 114             | osm | class    | type           | admin | addr+postcode | geometry |
 
 115             | R1  | boundary | administrative | 6     | 112           | :b0      |
 
 116             | R34 | boundary | administrative | 8     | 112 DE        | :b1:E    |
 
 117             | R4  | boundary | administrative | 10    | 112 DE 34     | :b2:N    |
 
 119             | osm | class    | type           | geometry |
 
 120             | W93 | highway  | residential    | :w2N     |
 
 122             | osm | class    | type        | addr+postcode | geometry |
 
 123             | W22 | building | yes         | 445023        | :building:w2N |
 
 126             | object | postcode  |
 
 129     Scenario: Postcodes are added to the postcode and word table
 
 131            | osm | class | type  | addr+postcode | addr+housenumber | geometry |
 
 132            | N34 | place | house | 01982         | 111              |country:de |
 
 134         Then location_postcode contains exactly
 
 135            | country | postcode | geometry |
 
 136            | de      | 01982    | country:de |
 
 138            | word  | class | type |
 
 139            | 01982 | place | postcode |