コード例 #1
0
ファイル: test_utilities.py プロジェクト: woodsouth/improver
 def test_check_exception_is_raised(self):
     """
     Test that the expected results are returned for the bounds_pairing.
     """
     cube_name = "nonsense"
     cube_units = Unit("degreesC")
     msg = "The bounds_pairing_key"
     with self.assertRaisesRegex(KeyError, msg):
         get_bounds_of_distribution(cube_name, cube_units)
コード例 #2
0
ファイル: test_utilities.py プロジェクト: arh89/improver
 def test_check_data(self):
     """
     Test that the expected results are returned for the bounds_pairing.
     """
     cube_name = "air_temperature"
     cube_units = Unit("degreesC")
     bounds_pairing = (-100, 60)
     result = (get_bounds_of_distribution(cube_name, cube_units))
     self.assertArrayAlmostEqual(result, bounds_pairing)
コード例 #3
0
ファイル: test_utilities.py プロジェクト: arh89/improver
 def test_check_unit_conversion(self):
     """
     Test that the expected results are returned for the bounds_pairing,
     if the units of the bounds_pairings need to be converted to match
     the units of the forecast.
     """
     cube_name = "air_temperature"
     cube_units = Unit("fahrenheit")
     bounds_pairing = (-148, 140)  # In fahrenheit
     result = (get_bounds_of_distribution(cube_name, cube_units))
     self.assertArrayAlmostEqual(result, bounds_pairing)
コード例 #4
0
ファイル: test_utilities.py プロジェクト: woodsouth/improver
 def test_basic(self):
     """Test that the result is a numpy array."""
     cube_name = "air_temperature"
     cube_units = Unit("degreesC")
     result = get_bounds_of_distribution(cube_name, cube_units)
     self.assertIsInstance(result, np.ndarray)