+ assert_in(attr, addr_parts)
+
+@then(u'address of result (?P<lid>\d+) is')
+def check_address(context, lid):
+ context.execute_steps("then more than %s results are returned" % lid)
+
+ addr_parts = dict(context.response.result[int(lid)]['address'])
+
+ for line in context.table:
+ assert_in(line['type'], addr_parts)
+ assert_equal(addr_parts[line['type']], line['value'],
+ "Bad address value for %s" % line['type'])
+ del addr_parts[line['type']]
+
+ eq_(0, len(addr_parts), "Additional address parts found: %s" % str(addr_parts))
+
+@then(u'result (?P<lid>\d+ )?has bounding box in (?P<coords>[\d,.-]+)')
+def step_impl(context, lid, coords):
+ if lid is None:
+ context.execute_steps("then at least 1 result is returned")
+ bboxes = context.response.property_list('boundingbox')
+ else:
+ context.execute_steps("then more than %sresults are returned" % lid)
+ bboxes = [ context.response.result[int(lid)]['boundingbox']]
+
+ coord = [ float(x) for x in coords.split(',') ]
+
+ for bbox in bboxes:
+ if isinstance(bbox, str):
+ bbox = bbox.split(',')
+ bbox = [ float(x) for x in bbox ]
+
+ assert_greater_equal(bbox[0], coord[0])
+ assert_less_equal(bbox[1], coord[1])
+ assert_greater_equal(bbox[2], coord[2])
+ assert_less_equal(bbox[3], coord[3])