Exemple #1
0
 def test_chronological_order_exception_analysis_year(self):
     """Coastal Blue Carbon: Test exception checking analysis year order."""
     from natcap.invest.coastal_blue_carbon \
         import coastal_blue_carbon as cbc
     self.args['analysis_year'] = 2000
     with self.assertRaises(ValueError):
         cbc.get_inputs(self.args)
Exemple #2
0
 def test_chronological_order_exception(self):
     """Coastal Blue Carbon: Test exception checking chronological order."""
     from natcap.invest.coastal_blue_carbon \
         import coastal_blue_carbon as cbc
     self.args['lulc_transition_years_list'] = [2005, 2000]
     with self.assertRaises(ValueError):
         cbc.get_inputs(self.args)
Exemple #3
0
 def test_get_price_table_exception(self):
     """Coastal Blue Carbon: Test price table exception."""
     from natcap.invest.coastal_blue_carbon \
         import coastal_blue_carbon as cbc
     self.args['price_table_uri'] = os.path.join(
         self.args['workspace_dir'], 'price.csv')
     self.args['do_price_table'] = True
     self.args['price_table_uri'] = _create_table(
         self.args['price_table_uri'], price_table_list)
     with self.assertRaises(KeyError):
         cbc.get_inputs(self.args)
Exemple #4
0
    def test_get_inputs(self):
        """Coastal Blue Carbon: Test get_inputs function in IO module."""
        from natcap.invest.coastal_blue_carbon \
            import coastal_blue_carbon as cbc

        d = cbc.get_inputs(self.args)
        # check several items in the data dictionary to check that the inputs
        # are properly fetched.
        self.assertEqual(d['lulc_to_Hb'][0], 0.0)
        self.assertEqual(d['lulc_to_Hb'][1], 1.0)
        self.assertEqual(len(d['price_t']), 16)
        self.assertEqual(len(d['snapshot_years']), 4)
        self.assertEqual(len(d['transition_years']), 2)