示例#1
0
    def test_wrongDisc_fail(self):
        """Wrong discount rates"""
        ent = Entity()
        ent.read_excel(ENT_TEMPLATE_XLS)
        ent.disc_rates.rates = np.array([1, 2])
        with self.assertRaises(ValueError) as cm:
            ent.check()
        self.assertIn('DiscRates.rates', str(cm.exception))

        with self.assertRaises(ValueError) as cm:
            ent.disc_rates = Exposures()
        self.assertIn('DiscRates', str(cm.exception))
示例#2
0
    def test_wrongDisc_fail(self):
        """Wrong discount rates"""
        ent = Entity()
        ent.read_excel(ENT_TEMPLATE_XLS)
        ent.disc_rates.rates = np.array([1, 2])
        with self.assertLogs('climada.util.checker', level='ERROR') as cm:
            with self.assertRaises(ValueError):
                ent.check()
        self.assertIn('DiscRates.rates', cm.output[0])

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