def test_alias_change_after_init_two_variables(self): kwds = self.get_multiple_variable_request_dataset_dictionary() rd = RequestDataset(**kwds) self.assertEqual(rd.name, 'tas_tasmax') with self.assertRaises(RequestValidationError): rd.alias = 'foo' rd.alias = ['foo', 'foo2'] self.assertEqual(rd.alias, ('foo', 'foo2')) self.assertEqual(rd.name, 'foo_foo2') with self.assertRaises(RequestValidationError): rd.units = 'crap' with self.assertRaises(RequestValidationError): rd.units = ('crap', 'crap') rd.units = ['celsius', 'celsius'] self.assertEqual(rd.units, ('celsius', 'celsius'))
def test_alias(self): path = self.test_data.get_uri('cancm4_tas') rd = RequestDataset(uri=path) self.assertIsNone(rd._alias) self.assertEqual(rd.alias, 'tas') rd.alias = 'temperature' self.assertEqual(rd.alias, 'temperature')