Testing the pelicun.model module¶
These are unit and integration tests on the model module of pelicun.
-
pelicun.tests.test_model.
test_FragilityFunction_Pexc_lognormal_unit_mean_unit_std
()[source]¶ Given a lognormal fragility function with theta=1.0 and beta=1.0, test if the calculated exceedance probabilities are sufficiently accurate. The reference results are based on a standard normal table. This limits the accuracy of testing to an absolute probability difference of 1e-5.
-
pelicun.tests.test_model.
test_FragilityFunction_Pexc_lognormal_non_trivial_case
()[source]¶ Given a lognormal fragility function with theta=0.5 and beta=0.2, test if the calculated exceedance probabilities are sufficiently accurate. The reference results are based on a standard normal table. This limits the accuracy of testing to an absolute probability difference of 1e-5.
-
pelicun.tests.test_model.
test_FragilityFunction_Pexc_lognormal_zero_input
()[source]¶ Given a zero EDP input to a lognormal fragility function, the result shall be 0 exceedance probability, even though zero input in log space shall correspond to -infinity. This slight modification makes our lives much easier when real inputs are fed to the fragility functions.
-
pelicun.tests.test_model.
test_FragilityFunction_Pexc_lognormal_nonzero_scalar_input
()[source]¶ Given a nonzero scalar EDP input, the fragility function should return a nonzero scalar output.
-
pelicun.tests.test_model.
test_FragilityFunction_Pexc_multiple_damage_states_with_correlation
()[source]¶ Test if the fragility function returns an appropriate list of exceedance probabilities for various scenarios with multiple damage states that have potentially correlated fragilities.
-
pelicun.tests.test_model.
test_FragilityFunction_DSG_ID_given_EDP_general
()[source]¶ Test if the DSG_IDs returned by the function are appropriate using exceedance probabilities from the already tested P_exc function.
-
pelicun.tests.test_model.
test_ConsequenceFunction_fixed_median_value
()[source]¶ Test if the function returns the prescribed median.
-
pelicun.tests.test_model.
test_ConsequenceFunction_bounded_linear_median_value
()[source]¶ Test if the function returns an appropriate output for single quantities and for quantity arrays, and if it raises an error if the quantity is not specified for a quantity-dependent median.
-
pelicun.tests.test_model.
test_ConsequenceFunction_sample_unit_DV
()[source]¶ Test if the function samples the DV distribution properly. Note that we have already tested the sampling algorithm in the uq module, so we will not do a thorough verification of the samples here, but rather check for errors in the inputs that would typically lead to significant mistakes in the results.
-
pelicun.tests.test_model.
test_DamageState_weight
()[source]¶ Test if the damage state returns the assigned weight value.
-
pelicun.tests.test_model.
test_DamageState_description
()[source]¶ Test if the damage state returns the assigned description.
-
pelicun.tests.test_model.
test_DamageState_repair_cost_sampling
()[source]¶ Test if the repair cost consequence function is properly linked to the damage state and if it returns the requested samples.
-
pelicun.tests.test_model.
test_DamageState_reconstruction_time_sampling
()[source]¶ Test if the reconstruction time consequence function is properly linked to the damage state and if it returns the requested samples.
-
pelicun.tests.test_model.
test_DamageState_red_tag_sampling
()[source]¶ Test if the red tag consequence function is properly linked to the damage state and if it returns the requested samples.
-
pelicun.tests.test_model.
test_DamageState_injury_sampling
()[source]¶ Test if the set of injury consequence functions is properly linked to the damage state and if it returns the requested samples.
-
pelicun.tests.test_model.
test_DamageStateGroup_kind
()[source]¶ Test if the damage state group returns the assigned group type.