Example #1
0
    def test_wrongMeas_fail(self):
        """Wrong measures"""
        ent = Entity()
        ent.read_excel(ENT_TEMPLATE_XLS)
        actions = ent.measures.get_measure('TC')
        actions[0].color_rgb = np.array([1, 2])
        with self.assertRaises(ValueError) as cm:
            ent.check()
        self.assertIn('Measure.color_rgb', str(cm.exception))

        with self.assertRaises(ValueError) as cm:
            ent.measures = Exposures()
        self.assertIn('MeasureSet', str(cm.exception))
Example #2
0
    def test_wrongMeas_fail(self):
        """Wrong measures"""
        ent = Entity()
        ent.read_excel(ENT_TEMPLATE_XLS)
        actions = ent.measures.get_measure('TC')
        actions[0].color_rgb = np.array([1, 2])
        with self.assertLogs('climada.util.checker', level='ERROR') as cm:
            with self.assertRaises(ValueError):
                ent.check()
        self.assertIn('Measure.color_rgb', cm.output[0])

        with self.assertLogs('climada.entity.entity_def', level='ERROR') as cm:
            with self.assertRaises(ValueError):
                ent.measures = Exposures()
        self.assertIn('MeasureSet', cm.output[0])