Example #1
0
 def test_raises_error_missing_cubes_global(self):
     """Test check_input_cubes method raises error if data is missing"""
     plugin = WeatherSymbols(wxtree="global")
     cubes = self.cubes.extract(self.gbl)[0:3]
     msg = "Weather Symbols input cubes are missing"
     with self.assertRaisesRegex(IOError, msg):
         plugin.check_input_cubes(cubes)
Example #2
0
 def test_raises_error_missing_cubes_global(self):
     """Test check_input_cubes method raises error if data is missing"""
     plugin = WeatherSymbols(wxtree='global')
     cubes = set_up_wxcubes_global()[0:3]
     msg = 'Weather Symbols input cubes are missing'
     with self.assertRaisesRegex(IOError, msg):
         plugin.check_input_cubes(cubes)
Example #3
0
 def test_raises_error_missing_cubes(self):
     """Test check_input_cubes method raises error if data is missing"""
     plugin = WeatherSymbols()
     cubes = self.cubes.pop()
     msg = 'Weather Symbols input cubes are missing'
     with self.assertRaisesRegex(IOError, msg):
         plugin.check_input_cubes(cubes)
Example #4
0
 def test_raises_error_missing_threshold(self):
     """Test check_input_cubes method raises error if data is missing"""
     plugin = WeatherSymbols()
     cubes = self.cubes
     cubes[0] = cubes[0][0]
     msg = "Weather Symbols input cubes are missing"
     with self.assertRaisesRegex(IOError, msg):
         plugin.check_input_cubes(cubes)
    def test_incorrect_units(self):
        """Test that check_input_cubes method raises an error if the units are
        incompatible between the input cube and the decision tree."""
        plugin = WeatherSymbols()

        msg = "Unable to convert from"
        self.cubes[0].coord('threshold').units = Unit('mm kg-1')
        with self.assertRaisesRegexp(ValueError, msg):
            plugin.check_input_cubes(self.cubes)
Example #6
0
 def test_no_lightning(self):
     """Test check_input_cubes raises no error if lightning missing"""
     plugin = WeatherSymbols()
     result = plugin.check_input_cubes(self.cubes_no_lightning)
     self.assertIsInstance(result, dict)
     self.assertEqual(len(result), 1)
     self.assertTrue('lightning' in result)
Example #7
0
 def test_basic_global(self):
     """Test check_input_cubes method has no error if global data is OK"""
     plugin = WeatherSymbols(wxtree='global')
     cubes = set_up_wxcubes_global()
     self.assertEqual(plugin.check_input_cubes(cubes), None)
Example #8
0
 def test_basic(self):
     """Test check_input_cubes method raises no error if the data is OK"""
     plugin = WeatherSymbols()
     self.assertEqual(plugin.check_input_cubes(self.cubes), None)
Example #9
0
 def test_basic_global(self):
     """Test check_input_cubes method has no error if global data is OK"""
     plugin = WeatherSymbols(wxtree="global")
     cubes = self.cubes.extract(self.gbl)
     self.assertEqual(plugin.check_input_cubes(cubes), None)