def test_table_id_lookup(self): x = cmip6.CMIP6_CVs() self.assertEqual(x.lookup('AERmon', 'table_id', 'frequency'), set([dt_freq('mon')])) self.assertEqual(x.lookup('AERmon', 'table_id', 'table_freq'), set(['mon'])) self.assertEqual( x.lookup(dt_freq('mon'), 'frequency', 'table_id'), set([ 'EmonZ', 'AERmon', 'SImon', 'Amon', 'CFmon', 'Omon', 'ImonGre', 'Emon', 'ImonAnt', 'Lmon', 'LImon', 'Oclim', 'AERmonZ' ])) self.assertEqual( x.lookup('mon', 'table_freq', 'table_id'), set([ 'EmonZ', 'AERmon', 'SImon', 'Amon', 'CFmon', 'Omon', 'ImonGre', 'Emon', 'ImonAnt', 'Lmon', 'LImon', 'Oclim', 'AERmonZ' ]))
def test_datefreq(self): for k in self.test_freqs: for tbl in self.test_freqs[k]: d = cmip6.CMIP6_MIPTable(tbl) self.assertEqual(dt_freq(k), d.frequency)
def test_is_static(self): self.assertTrue(dt_freq(self.all_freqs[0]).is_static) for i in range(1, len(self.all_freqs) - 1): self.assertFalse(dt_freq(self.all_freqs[i]).is_static)
def test_comparisons(self): for i in range(0, len(self.all_freqs) - 1): self.assertTrue( dt_freq(self.all_freqs[i]) >= dt_freq(self.all_freqs[i + 1]))
def test_string_output(self): for s in self.all_freqs: self.assertEqual(s, str(dt_freq(s)))
def test_datefreq(self): for k in self.test_freqs: for tbl in self.test_freqs[k]: d = cmip6.parse_mip_table_id(tbl) self.assertEqual(dt_freq(k), d['date_freq'])