def test_missing_land_mask(self): """Test attempt to read land_mask with missing land_mask netcdf file.""" Call(['rm', self.land_path]) msg = 'Land mask file not found.' with self.assertRaisesRegex(IOError, msg): Plugin(self.diagnostics, self.directory)
def test_read_orography(self): """Test reading an orography netcdf file.""" diagnostics = {} result = Plugin(diagnostics, self.directory) self.assertIn('orography', result) self.assertIsInstance(result['orography'], Cube) self.assertArrayEqual(result['orography'].data, self.orography.data)
def test_read_land_mask(self): """Test reading a landmask netcdf file if a diagnostic makes use of a land constraint condition.""" result = Plugin(self.diagnostics, self.directory) self.assertIn('land_mask', result) self.assertIsInstance(result['land_mask'], Cube) self.assertArrayEqual(result['land_mask'].data, self.land.data)
def test_return_type(self): """Test return type is a dictionary containing cubes.""" diagnostics = {} result = Plugin(diagnostics, self.directory) self.assertIsInstance(result, dict) for item in result.values(): self.assertIsInstance(item, Cube)
def test_missing_orography(self): """Test attempt to read orography with missing orography netcdf file.""" Call(['rm', self.orography_path]) diagnostics = {} msg = 'Orography file not found.' with self.assertRaisesRegex(IOError, msg): Plugin(diagnostics, self.directory)