def test_eq_fail(self): comp = metocean.Component('uri', stock.property_component_cf()) self.assertNotEqual(self.comp, comp) components = [stock.simple_component_cf(), stock.compound_component_cf()] comp = metocean.Component(self.comp.uri, components) self.assertNotEqual(self.comp, comp) properties = stock.property_component_cf().values() pcomp = metocean.PropertyComponent('uri', properties) comp = metocean.Component(self.comp.uri, pcomp) self.assertNotEqual(self.comp, comp)
def test_getitem(self): prop = stock.property_cf_standard_name() self.assertEqual(self.comp[prop.name], prop) self.assertEqual(self.comp[prop.name.notation], prop) self.assertEqual(self.comp[0], stock.property_component_cf()) self.assertIsNone(self.comp['wibble']) self.assertEqual(self.ccomp[0], stock.simple_component_cf()) with self.assertRaises(TypeError): self.ccomp[prop.name] with self.assertRaises(TypeError): self.ccomp[prop.name.notation] with self.assertRaises(TypeError): self.ccomp['wibble']
def test_eq_pass(self): self.assertEqual(self.comp, stock.simple_component_cf()) self.assertEqual(self.ccomp, stock.compound_component_cf())
def setUp(self): self.comp = stock.simple_component_cf() self.ccomp = stock.compound_component_cf()