|
35 | 35 | from climada.test import get_test_file |
36 | 36 |
|
37 | 37 |
|
38 | | -HAZ_TEST_MAT = get_test_file('atl_prob_no_name', file_format='matlab') |
39 | 38 | ENT_TEST_MAT = get_test_file('demo_today', file_format='MAT-file') |
40 | | - |
| 39 | +HAZ_TEST_TC :Path = get_test_file('test_tc_florida') |
41 | 40 |
|
42 | 41 | class TestSteps(unittest.TestCase): |
43 | 42 | """Test intermediate steps""" |
44 | 43 | def test_calc_impact_measures_pass(self): |
45 | 44 | """Test _calc_impact_measures against reference value""" |
46 | | - self.assertTrue(HAZ_TEST_MAT.is_file(), "{} is not a file".format(HAZ_TEST_MAT)) |
47 | | - hazard = Hazard.from_mat(HAZ_TEST_MAT) |
| 45 | + self.assertTrue(HAZ_TEST_TC.is_file(), "{} is not a file".format(HAZ_TEST_TC)) |
| 46 | + hazard = Hazard.from_hdf5(HAZ_TEST_TC) |
48 | 47 |
|
49 | 48 | self.assertTrue(ENT_TEST_MAT.is_file(), "{} is not a file".format(ENT_TEST_MAT)) |
50 | 49 | entity = Entity.from_mat(ENT_TEST_MAT) |
@@ -230,7 +229,7 @@ def test_cb_one_meas_fut_pass(self): |
230 | 229 |
|
231 | 230 | def test_calc_cb_no_change_pass(self): |
232 | 231 | """Test _calc_cost_benefit without present value against reference value""" |
233 | | - hazard = Hazard.from_mat(HAZ_TEST_MAT) |
| 232 | + hazard = Hazard.from_hdf5(HAZ_TEST_TC) |
234 | 233 | entity = Entity.from_mat(ENT_TEST_MAT) |
235 | 234 | entity.measures._data['TC'] = entity.measures._data.pop('XX') |
236 | 235 | for meas in entity.measures.get_measure('TC'): |
@@ -267,7 +266,7 @@ def test_calc_cb_no_change_pass(self): |
267 | 266 |
|
268 | 267 | def test_calc_cb_change_pass(self): |
269 | 268 | """Test _calc_cost_benefit with present value against reference value""" |
270 | | - hazard = Hazard.from_mat(HAZ_TEST_MAT) |
| 269 | + hazard = Hazard.from_hdf5(HAZ_TEST_TC) |
271 | 270 | entity = Entity.from_mat(ENT_TEST_MAT) |
272 | 271 | entity.measures._data['TC'] = entity.measures._data.pop('XX') |
273 | 272 | for meas in entity.measures.get_measure('TC'): |
@@ -438,7 +437,7 @@ def test_norm_value(self): |
438 | 437 |
|
439 | 438 | def test_combine_fut_pass(self): |
440 | 439 | """Test combine_measures with present and future""" |
441 | | - hazard = Hazard.from_mat(HAZ_TEST_MAT) |
| 440 | + hazard = Hazard.from_hdf5(HAZ_TEST_TC) |
442 | 441 | entity = Entity.from_excel(ENT_DEMO_TODAY) |
443 | 442 | entity.check() |
444 | 443 | entity.exposures.ref_year = 2018 |
@@ -498,7 +497,7 @@ def test_combine_fut_pass(self): |
498 | 497 |
|
499 | 498 | def test_combine_current_pass(self): |
500 | 499 | """Test combine_measures with only future""" |
501 | | - hazard = Hazard.from_mat(HAZ_TEST_MAT) |
| 500 | + hazard = Hazard.from_hdf5(HAZ_TEST_TC) |
502 | 501 | entity = Entity.from_excel(ENT_DEMO_TODAY) |
503 | 502 | entity.check() |
504 | 503 | entity.exposures.ref_year = 2018 |
@@ -538,7 +537,7 @@ def test_combine_current_pass(self): |
538 | 537 |
|
539 | 538 | def test_apply_transf_current_pass(self): |
540 | 539 | """Test apply_risk_transfer with only future""" |
541 | | - hazard = Hazard.from_mat(HAZ_TEST_MAT) |
| 540 | + hazard = Hazard.from_hdf5(HAZ_TEST_TC) |
542 | 541 | entity = Entity.from_excel(ENT_DEMO_TODAY) |
543 | 542 | entity.check() |
544 | 543 | entity.exposures.ref_year = 2018 |
@@ -588,7 +587,7 @@ def test_apply_transf_current_pass(self): |
588 | 587 |
|
589 | 588 | def test_apply_transf_cost_fact_pass(self): |
590 | 589 | """Test apply_risk_transfer with only future annd cost factor""" |
591 | | - hazard = Hazard.from_mat(HAZ_TEST_MAT) |
| 590 | + hazard = Hazard.from_hdf5(HAZ_TEST_TC) |
592 | 591 | entity = Entity.from_excel(ENT_DEMO_TODAY) |
593 | 592 | entity.check() |
594 | 593 | entity.exposures.ref_year = 2018 |
@@ -636,7 +635,7 @@ def test_apply_transf_cost_fact_pass(self): |
636 | 635 |
|
637 | 636 | def test_apply_transf_future_pass(self): |
638 | 637 | """Test apply_risk_transfer with present and future""" |
639 | | - hazard = Hazard.from_mat(HAZ_TEST_MAT) |
| 638 | + hazard = Hazard.from_hdf5(HAZ_TEST_TC) |
640 | 639 | entity = Entity.from_excel(ENT_DEMO_TODAY) |
641 | 640 | entity.check() |
642 | 641 | entity.exposures.ref_year = 2018 |
@@ -692,7 +691,7 @@ def test_apply_transf_future_pass(self): |
692 | 691 |
|
693 | 692 | def test_remove_measure(self): |
694 | 693 | """Test remove_measure method""" |
695 | | - hazard = Hazard.from_mat(HAZ_TEST_MAT) |
| 694 | + hazard = Hazard.from_hdf5(HAZ_TEST_TC) |
696 | 695 | entity = Entity.from_excel(ENT_DEMO_TODAY) |
697 | 696 | entity.check() |
698 | 697 | entity.exposures.ref_year = 2018 |
@@ -720,7 +719,7 @@ class TestCalc(unittest.TestCase): |
720 | 719 | def test_calc_change_pass(self): |
721 | 720 | """Test calc with future change""" |
722 | 721 | # present |
723 | | - hazard = Hazard.from_mat(HAZ_TEST_MAT) |
| 722 | + hazard = Hazard.from_hdf5(HAZ_TEST_TC) |
724 | 723 | entity = Entity.from_excel(ENT_DEMO_TODAY) |
725 | 724 | entity.exposures.gdf.rename(columns={'impf_': 'impf_TC'}, inplace=True) |
726 | 725 | entity.check() |
@@ -777,7 +776,7 @@ def test_calc_change_pass(self): |
777 | 776 |
|
778 | 777 | def test_calc_no_change_pass(self): |
779 | 778 | """Test calc without future change""" |
780 | | - hazard = Hazard.from_mat(HAZ_TEST_MAT) |
| 779 | + hazard = Hazard.from_hdf5(HAZ_TEST_TC) |
781 | 780 | entity = Entity.from_excel(ENT_DEMO_TODAY) |
782 | 781 | entity.check() |
783 | 782 | entity.exposures.ref_year = 2018 |
@@ -808,7 +807,7 @@ class TestRiskFuncs(unittest.TestCase): |
808 | 807 | def test_impact(self): |
809 | 808 | ent = Entity.from_excel(ENT_DEMO_TODAY) |
810 | 809 | ent.check() |
811 | | - hazard = Hazard.from_mat(HAZ_TEST_MAT) |
| 810 | + hazard = Hazard.from_hdf5(HAZ_TEST_TC) |
812 | 811 | impact = ImpactCalc(ent.exposures, ent.impact_funcs, hazard).impact() |
813 | 812 | return impact |
814 | 813 |
|
|
0 commit comments