Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 3
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)
Ejemplo n.º 4
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)
Ejemplo n.º 5
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)
Ejemplo n.º 6
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)
Ejemplo n.º 7
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)
Ejemplo n.º 8
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)
Ejemplo n.º 9
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)