class TestAreacello(unittest.TestCase): """Test areacello fixes.""" def setUp(self): """Prepare tests.""" self.cube = Cube([1.0], var_name='areacello', units='m-2') self.vardef = get_var_info('CMIP5', 'fx', self.cube.var_name) self.fix = Areacello(self.vardef) def test_get(self): """Test fix get""" self.assertListEqual( Fix.get_fixes('CMIP5', 'GFDL-CM2P1', 'Amon', 'areacello'), [Areacello(self.vardef), AllVars(self.vardef)]) def test_fix_metadata(self): """Test data fix.""" cube = self.fix.fix_metadata((self.cube, ))[0] self.assertEqual(cube.data[0], 1.0) self.assertEqual(cube.units, Unit('m2')) def test_fix_data(self): """Test data fix.""" self.cube.units = 'm2' cube = self.fix.fix_metadata((self.cube, ))[0] self.assertEqual(cube.data[0], 1.0) self.assertEqual(cube.units, Unit('m2'))
def test_get(self): """Test fix get""" self.assertListEqual( Fix.get_fixes('CMIP5', 'GFDL-CM2P1', 'Amon', 'areacello'), [Areacello(self.vardef), AllVars(self.vardef)])
def setUp(self): """Prepare tests.""" self.cube = Cube([1.0], var_name='areacello', units='m-2') self.vardef = get_var_info('CMIP5', 'fx', self.cube.var_name) self.fix = Areacello(self.vardef)
def setUp(self): """Prepare tests.""" self.cube = Cube([1.0], var_name='areacello', units='m-2') self.fix = Areacello()