def test_bbox_from_flat_list(self): for bbox_lst in [[46.07, 13.23, 46.24, 13.57], [46.24, 13.23, 46.07, 13.57], [46.07, 13.57, 46.24, 13.23], [46.24, 13.57, 46.07, 13.23]]: with self.subTest(msg="bbox={}".format(bbox_lst)): bbox = BBox(bbox_lst, CRS.WGS84) self.assertEqual(bbox.get_lower_left(), (46.07, 13.23)) self.assertEqual(bbox.get_upper_right(), (46.24, 13.57)) self.assertEqual(bbox.get_crs(), CRS.WGS84)
def test_bbox_from_dict(self): bbox_dict = { 'min_x': 46.07, 'min_y': 13.23, 'max_x': 46.24, 'max_y': 13.57 } bbox = BBox(bbox_dict, CRS.WGS84) self.assertEqual(bbox.get_upper_right(), (46.24, 13.57)) self.assertEqual(bbox.get_lower_left(), (46.07, 13.23)) self.assertEqual(bbox.get_crs(), CRS.WGS84)
def test_bbox_from_nested_tuple(self): bbox_tup = (46.07, 13.23), (46.24, 13.57) bbox = BBox(bbox_tup, CRS.WGS84) self.assertEqual(bbox.get_upper_right(), (46.24, 13.57)) self.assertEqual(bbox.get_lower_left(), (46.07, 13.23)) self.assertEqual(bbox.get_crs(), CRS.WGS84)
def test_bbox_from_nested_list(self): bbox_lst = [[-46.07, -13.23], [46.24, 13.57]] bbox = BBox(bbox_lst, CRS.WGS84) self.assertEqual(bbox.get_upper_right(), (46.24, 13.57)) self.assertEqual(bbox.get_lower_left(), (-46.07, -13.23)) self.assertEqual(bbox.get_crs(), CRS.WGS84)
def test_bbox_from_string(self): bbox_str = '46.07, 13.23, 46.24, 13.57' bbox = BBox(bbox_str, CRS.WGS84) self.assertEqual(bbox.get_lower_left(), (46.07, 13.23)) self.assertEqual(bbox.get_upper_right(), (46.24, 13.57)) self.assertEqual(bbox.get_crs(), CRS.WGS84)
def test_bbox_from_list_tuple_combo(self): bbox_list = [(46.07, 13.23), (46.24, 13.57)] bbox = BBox(bbox_list, CRS.WGS84) self.assertEqual(bbox.get_upper_right(), (46.24, 13.57)) self.assertEqual(bbox.get_lower_left(), (46.07, 13.23)) self.assertEqual(bbox.get_crs(), CRS.WGS84)