Beispiel #1
0
    def test_wrongImpFun_fail(self):
        """Wrong impact functions"""
        ent = Entity()
        ent.read_excel(ENT_TEMPLATE_XLS)
        ent.impact_funcs.get_func('TC', 1).paa = np.array([1, 2])
        with self.assertRaises(ValueError) as cm:
            ent.check()
        self.assertIn('ImpactFunc.paa', str(cm.exception))

        with self.assertRaises(ValueError) as cm:
            ent.impact_funcs = Exposures()
        self.assertIn('ImpactFuncSet', str(cm.exception))
Beispiel #2
0
    def test_wrongImpFun_fail(self):
        """Wrong impact functions"""
        ent = Entity()
        ent.read_excel(ENT_TEMPLATE_XLS)
        ent.impact_funcs.get_func('TC', 1).paa = np.array([1, 2])
        with self.assertLogs('climada.util.checker', level='ERROR') as cm:
            with self.assertRaises(ValueError):
                ent.check()
        self.assertIn('ImpactFunc.paa', cm.output[0])

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