diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6582edc..9fa1e3c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ exclude: | repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v6.0.0 hooks: - id: check-added-large-files - id: check-case-conflict @@ -42,7 +42,7 @@ repos: ['--no-error-on-unmatched-pattern', '--ignore-unknown'] - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.41.0 + rev: v0.45.0 hooks: - id: markdownlint args: ["--fix"] @@ -59,18 +59,18 @@ repos: args: ["--ignore=E006,E011"] - repo: https://github.com/shellcheck-py/shellcheck-py - rev: v0.10.0.1 + rev: v0.11.0.1 hooks: - id: shellcheck args: ["-x"] # Check external files - repo: https://github.com/Mateusz-Grzelinski/actionlint-py - rev: v1.7.1.15 + rev: v1.7.7.24 hooks: - id: actionlint - repo: https://github.com/adrienverge/yamllint.git - rev: v1.35.1 + rev: v1.37.1 hooks: - id: yamllint args: @@ -78,7 +78,7 @@ repos: ignore-from-file: [.gitignore],}"] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.2 + rev: v0.12.12 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix, --config=pyproject.toml] @@ -94,7 +94,7 @@ repos: then /bin/mkdir .mypy_cache; fi; exit 0' - repo: https://github.com/pre-commit/mirrors-mypy - rev: "v1.10.1" + rev: "v1.17.1" hooks: - id: mypy verbose: true diff --git a/tests/test_powerPlant.py b/tests/test_powerPlant.py index f8e9ee2..03a707a 100644 --- a/tests/test_powerPlant.py +++ b/tests/test_powerPlant.py @@ -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!!!") diff --git a/tests/test_realstate.py b/tests/test_realstate.py index bffd048..23bfff1 100644 --- a/tests/test_realstate.py +++ b/tests/test_realstate.py @@ -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( [ @@ -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 @@ -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}") @@ -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}")