def test_promoted_auxiliary_ignore(self): self.wibble = netcdf_variable('wibble', 'lat wibble', np.float) self.variables['wibble'] = self.wibble self.orography.coordinates = 'wibble' with mock.patch('netCDF4.Dataset', return_value=self.dataset), \ mock.patch('warnings.warn') as warn: cf_group = CFReader('dummy').cf_group.promoted promoted = ['wibble', 'orography'] self.assertEqual(set(cf_group.keys()), set(promoted)) for name in promoted: self.assertIs(cf_group[name].cf_data, getattr(self, name)) self.assertEqual(warn.call_count, 2)
def test_promoted_auxiliary_ignore(self): self.wibble = netcdf_variable('wibble', 'lat wibble', np.float) self.variables['wibble'] = self.wibble self.orography.coordinates = 'wibble' with mock.patch('netCDF4.Dataset', return_value=self.dataset), \ mock.patch('warnings.warn') as warn: cf_group = CFReader('dummy').cf_group.promoted promoted = ['wibble', 'orography'] self.assertEqual(set(cf_group.keys()), set(promoted)) for name in promoted: self.assertIs(cf_group[name].cf_data, getattr(self, name)) self.assertEqual(warn.call_count, 2)
def test_promoted_auxiliary_ignore(self): self.wibble = netcdf_variable("wibble", "lat wibble", np.float64) self.variables["wibble"] = self.wibble self.orography.coordinates = "wibble" with mock.patch("netCDF4.Dataset", return_value=self.dataset), mock.patch( "warnings.warn") as warn: cf_group = CFReader("dummy").cf_group.promoted promoted = ["wibble", "orography"] self.assertEqual(set(cf_group.keys()), set(promoted)) for name in promoted: self.assertIs(cf_group[name].cf_data, getattr(self, name)) self.assertEqual(warn.call_count, 2)