예제 #1
0
 def test_GIVEN_limited_bounds_crossing_meridian_WHEN_extent_in_bounds_THEN_accepted(self):
     spatial_extent = SpatialExtent(45, -45, -1, 4)
     spatial_extent.set_lon_w(1)
     spatial_extent.set_lon_e(2)
     spatial_extent = SpatialExtent(45, -45, -2, 4)
     spatial_extent.set_lon_w(-1)
     spatial_extent.set_lon_e(2)
예제 #2
0
 def test_GIVEN_limited_bounds_WHEN_longitude_wraps_around_earth_THEN_raise_InvalidSpatialExtent(self):
     with self.assertRaises(InvalidSpatialExtent, msg="Should have thrown an InvalidSpatialExtent exception"):
         spatial_extent = SpatialExtent(45, -45, 150, -150)
         spatial_extent.set_lon_w(-160)
         spatial_extent.set_lon_e(160)
         spatial_extent = SpatialExtent(45, -45, -30, 30)
         spatial_extent.set_lon_w(25)
         spatial_extent.set_lon_e(-25)
예제 #3
0
 def test_GIVEN_global_bounds_WHEN_given_latitude_less_than_minus_90_raise_InvalidSpatialExtent(self):
     with self.assertRaises(InvalidSpatialExtent, msg="Should have thrown an InvalidSpatialExtent exception"):
         spatial_extent = SpatialExtent(90, -90, -180, 180)
         spatial_extent.set_lat_n(45)
         spatial_extent.set_lat_s(-90.000001)
     with self.assertRaises(InvalidSpatialExtent, msg="Should have thrown an InvalidSpatialExtent exception"):
         spatial_extent = SpatialExtent(90, -90, -180, 180)
         spatial_extent.set_lat_n(5)
         spatial_extent.set_lat_s(-180)
예제 #4
0
 def test_GIVEN_global_bounds_WHEN_longitude_less_than_minus_180_THEN_raise_InvalidSpatialExtent(self):
     spatial_extent = SpatialExtent(90, -90, -180, 180)
     with self.assertRaises(InvalidSpatialExtent, msg="Should have thrown an InvalidSpatialExtent exception"):
         spatial_extent.set_lon_w(150)
         spatial_extent.set_lon_e(-180.0000000001)
     with self.assertRaises(InvalidSpatialExtent, msg="Should have thrown an InvalidSpatialExtent exception"):
         spatial_extent.set_lon_w(-220)
         spatial_extent.set_lon_e(90)
예제 #5
0
 def test_GIVEN_limited_bounds_not_enclosing_dateline_WHEN_longitude_does_enclose_dateline_THEN_raise_InvalidSpatialExtent(self):
     with self.assertRaises(InvalidSpatialExtent, msg="Should have thrown an InvalidSpatialExtent exception"):
         spatial_extent = SpatialExtent(45, -45, 30, 150)
         spatial_extent.set_lon_w(40)
         spatial_extent.set_lon_e(-170)
예제 #6
0
 def test_GIVEN_limited_bounds_WHEN_eastern_longitude_west_of_western_latitude_THEN_raises_InvalidSpatialExtent(self):
     with self.assertRaises(InvalidSpatialExtent, msg="Should have thrown an InvalidSpatialExtent exception"):
         spatial_extent = SpatialExtent(45, -45, -120, 120)
         spatial_extent.set_lon_e(10)
         spatial_extent.set_lon_w(20)
예제 #7
0
 def test_GIVEN_global_bounds_WHEN_longitudes_enclose_dateline_THEN_rejected(self):
     with self.assertRaises(InvalidSpatialExtent, msg="Should have thrown an InvalidSpatialExtent exception"):
         spatial_extent = SpatialExtent(90, -90, -180, 180)
         spatial_extent.set_lon_w(150)
         spatial_extent.set_lon_e(-150)
예제 #8
0
 def test_GIVEN_limited_bounds_WHEN_both_longitudes_inside_bounds_THEN_accepted(self):
     spatial_extent = SpatialExtent(45, -45, 50, 70)
     spatial_extent.set_lon_w(55)
     spatial_extent.set_lon_e(65)
예제 #9
0
 def test_GIVEN_limited_bounds_WHEN_both_longitudes_outside_bounds_THEN_raise_InvaldSpatialExtent(self):
     with self.assertRaises(InvalidSpatialExtent, msg="Should have thrown an InvalidSpatialExtent exception"):
         spatial_extent = SpatialExtent(45, -45, 50, 70)
         spatial_extent.set_lon_w(-100)
         spatial_extent.set_lon_e(160)
예제 #10
0
 def test_GIVEN_global_bounds_WHEN_longitude_equal_to_bounds_THEN_accepted(self):
     spatial_extent = SpatialExtent(90, -90, -180, 180)
     spatial_extent.set_lon_w(-180)
     spatial_extent.set_lon_e(180)
예제 #11
0
 def test_GIVEN_limited_bounds_WHEN_given_northern_latitude_below_southern_latitude_THEN_raise_InvalidSpatialExtent(self):
     with self.assertRaises(InvalidSpatialExtent, msg="Should have thrown an InvalidSpatialExtent exception"):
         spatial_extent = SpatialExtent(45, -45, -50, 50)
         spatial_extent.set_lat_n(1)
         spatial_extent.set_lat_s(30)
예제 #12
0
 def test_GIVEN_limited_bounds_WHEN_given_latitudes_in_bounds_THEN_accepted(self):
         spatial_extent = SpatialExtent(45, -45, -50, 50)
         spatial_extent.set_lat_n(30)
         spatial_extent.set_lat_s(1)
예제 #13
0
 def test_GIVEN_global_bounds_WHEN_given_latitude_equal_to_bounds_THEN_accepted(self):
     spatial_extent = SpatialExtent(90, -90, -180, 180)
     spatial_extent.set_lat_n(90)
     spatial_extent.set_lat_s(-90)