def test_invalid_location(self): """ Tests the format_locations method for an invalid location_format. """ query = ReservoirQuery(locations=self.locations) specs = PipeSpecSheet(location_format='bad_format') engineer = Engineer(query=query, specs=specs) with six.assertRaisesRegex(self, AttributeError, 'Invalid location format "bad_format"'): engineer._format_locations()
def test_format_for_box(self): """ Tests the format_locations method for a 'box' location_format. """ query = ReservoirQuery(locations=self.locations) specs = PipeSpecSheet(location_format='box') engineer = Engineer(query=query, specs=specs) engineer._format_locations() all_boxes = False for new_location in engineer.get_locations(): if new_location.shape == 'Rectangle': all_boxes = True else: all_boxes = False break self.assertTrue(all_boxes)
def test_format_for_radius(self): """ Tests the format_locations method for a 'radius' location_format. """ query = ReservoirQuery(locations=self.locations) specs = PipeSpecSheet(location_format='radius', radius_limit_km=100) engineer = Engineer(query=query, specs=specs) engineer._format_locations() all_circles = False for new_location in engineer.get_locations(): if new_location.shape == 'Circle': all_circles = True else: all_circles = False break self.assertTrue(all_circles)