"""
plist: Sequence[str]
if isinstance(ids, str):
- plist = ids.split(',')
+ plist = [s.strip() for s in ids.split(',')]
elif isinstance(ids, abc.Sequence):
plist = ids
else:
raise UsageError("Parameter 'excluded' needs to be a comma-separated list "
"or a Python list of numbers.")
- if any(not isinstance(i, int) or (isinstance(i, str) and not i.isdigit()) for i in plist):
+ if not all(isinstance(i, int) or (isinstance(i, str) and i.isdigit()) for i in plist):
raise UsageError("Parameter 'excluded' only takes place IDs.")
return [int(id) for id in plist if id]
#pylint: disable=too-many-arguments
-def extend_query_parts(queryparts: dict[str, Any], details: dict[str, Any],
+def extend_query_parts(queryparts: Dict[str, Any], details: Dict[str, Any],
feature_type: Optional[str],
namedetails: bool, extratags: bool,
excluded: Iterable[str]) -> None:
if len(oid) > 1 and oid[0] in 'RNWrnw' and oid[1:].isdigit():
places.append(napi.OsmID(oid[0], int(oid[1:])))
+ if len(places) > params.config().get_int('LOOKUP_MAX_COUNT'):
+ params.raise_error('Too many object IDs.')
+
if places:
results = await api.lookup(places, **details)
else:
details['min_rank'], details['max_rank'] = \
helpers.feature_type_to_rank(params.get('featureType', ''))
+ if params.get('featureType', None) is not None:
+ details['layers'] = napi.DataLayer.ADDRESS
query = params.get('q', None)
queryparts = {}
Then a HTTP 400 is returned
Scenario: Restrict to feature type country
- When sending xml search query "fürstentum"
- Then results contain
- | ID | class |
- | 1 | building |
When sending xml search query "fürstentum"
| featureType |
| country |
Scenario: Restrict to feature type state
When sending xml search query "Wangerberg"
- Then more than 1 result is returned
+ Then at least 1 result is returned
When sending xml search query "Wangerberg"
| featureType |
| state |
Scenario: Restrict to feature type city
When sending xml search query "vaduz"
- Then results contain
- | ID | place_rank |
- | 1 | 30 |
+ Then at least 1 result is returned
When sending xml search query "vaduz"
| featureType |
| city |
| svg |
| geokml |
+ @v1-api-php-only
Scenario: Search along a route
When sending json search query "rathaus" with address
Then result addresses contain
| class | type |
| club | scout |
+ @v1-api-php-only
Scenario: With multiple amenity search only the first is used
When sending json search query "[club=scout] [church] vaduz"
Then results contain
| class | type |
| leisure | firepit |
+ @v1-api-php-only
Scenario: Arbitrary key/value search near given coordinate and named place
When sending json search query "[leisure=firepit] ebenholz 47° 9′ 26″ N 9° 36′ 45″ E"
Then results contain
Then result addresses contain
| ID | house_number |
| 0 | 11 |
- | 1 | 11 a |
Scenario Outline: Coordinate searches with white spaces
When sending json search query "<data>"
| foo | foo |
| FOO | FOO |
| __world | __world |
- | $me | \$me |
- | m1[4] | m1\[4\] |
- | d_r[$d] | d_r\[\$d\] |
Scenario Outline: Wrapping of illegal jsonp search requests
When sending json search query "Tokyo"
When importing
And sending search query "Main St <nr>"
Then results contain
- | osm | display_name |
- | N1 | <nr-list>, Main St |
+ | ID | osm | display_name |
+ | 0 | N1 | <nr-list>, Main St |
Examples:
| nr-list | nr |
@then(u'result header contains')
def check_header_attr(context):
+ context.execute_steps("Then a HTTP 200 is returned")
for line in context.table:
+ assert line['attr'] in context.response.header, \
+ f"Field '{line['attr']}' missing in header. Full header:\n{context.response.header}"
value = context.response.header[line['attr']]
assert re.fullmatch(line['value'], value) is not None, \
f"Attribute '{line['attr']}': expected: '{line['value']}', got '{value}'"