Skip to content

Commit

Permalink
Chore: pre-commit autoupdate
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Jan 13, 2025
1 parent 263c2ca commit ccff3a7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions tests/test_powerPlant.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ def test_power_plants():

loss_var = pp.financial_losses(damages=damage, energy_price=elec_price, r=r_var)

assert np.isclose(
loss_cst.mean(), loss_var.mean()
), "Losses are not calculated properly"
assert np.isclose(loss_cst.mean(), loss_var.mean()), (
"Losses are not calculated properly"
)

# Now the same pp in two different ways

pp2 = PowerPlants(capacity=900913242.0091324, av_rate=1, name=name)
loss_var2 = pp2.financial_losses(damages=damage, energy_price=elec_price, r=r_var)

assert np.isclose(
loss_var.mean(), loss_var2.mean()
), "Losses are not calculated properly"
assert np.isclose(loss_var.mean(), loss_var2.mean()), (
"Losses are not calculated properly"
)

print("FINISHED DCV TEST SUCCESSFULLY!!!")
26 changes: 13 additions & 13 deletions tests/test_realstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ def test_asset():
variance_loss = losses[0].var()
expected_variance_loss = 724.0
print(
f'Mean Financial Losses: {real_asset.financial_losses(["2030-02-09"], damage=discrete_rand_var)[0].mean()}'
f"Mean Financial Losses: {real_asset.financial_losses(['2030-02-09'], damage=discrete_rand_var)[0].mean()}"
)
print(
f'Variance Financial Losses: {real_asset.financial_losses(["2030-02-09"], damage=discrete_rand_var)[0].var()}'
f"Variance Financial Losses: {real_asset.financial_losses(['2030-02-09'], damage=discrete_rand_var)[0].var()}"
)
assert np.allclose(mean_loss, expected_mean_loss), "Mean is not calculated properly"
assert np.allclose(
variance_loss, expected_variance_loss
), "Variance is not calculated properly"
assert np.allclose(variance_loss, expected_variance_loss), (
"Variance is not calculated properly"
)

intervals_osc = np.array(
[
Expand Down Expand Up @@ -150,12 +150,12 @@ def test_asset():
]
)

assert np.allclose(
discrete_rand_var_osc.intervals, expected_intervals
), "Intervals are not calculated properly"
assert np.allclose(
discrete_rand_var_osc.probabilities, expected_probabilities
), "Probabilities are not calculated properly"
assert np.allclose(discrete_rand_var_osc.intervals, expected_intervals), (
"Intervals are not calculated properly"
)
assert np.allclose(discrete_rand_var_osc.probabilities, expected_probabilities), (
"Probabilities are not calculated properly"
)

# zero included

Expand Down Expand Up @@ -246,7 +246,7 @@ def test_asset():
loan_amounts=loan_amounts,
)

print(f" LTV mean value (first date, fist asset): {ltv[0,0].mean()}")
print(f" LTV mean value (first date, fist asset): {ltv[0, 0].mean()}")
means = DiscreteRandomVariable.means_vectorized(ltv)
print(f" LTV mean values: {means}")

Expand All @@ -257,7 +257,7 @@ def test_asset():
assert np.allclose(means, expected_means), "LTV mean values calculation failed"

# Variances
print(f" LTV variance (first date, fist asset): {ltv[0,0].var()}")
print(f" LTV variance (first date, fist asset): {ltv[0, 0].var()}")
vars = DiscreteRandomVariable.vars_vectorized(ltv)
print(f" LTV variances: {vars}")

Expand Down

0 comments on commit ccff3a7

Please sign in to comment.