- 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])
+ assert bbox[0] >= coord[0]
+ assert bbox[1] <= coord[1]
+ assert bbox[2] >= coord[2]
+ assert bbox[3] <= coord[3]
+
+@then(u'result (?P<lid>\d+ )?has centroid 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 = zip(context.response.property_list('lat'),
+ context.response.property_list('lon'))
+ else:
+ context.execute_steps("then more than %sresults are returned" % lid)
+ res = context.response.result[int(lid)]
+ bboxes = [ (res['lat'], res['lon']) ]
+
+ coord = [ float(x) for x in coords.split(',') ]
+
+ for lat, lon in bboxes:
+ lat = float(lat)
+ lon = float(lon)
+ assert lat >= coord[0]
+ assert lat <= coord[1]
+ assert lon >= coord[2]
+ assert lon <= coord[3]