Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️🪝 update pre-commit hooks #20

Merged
merged 2 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ repos:

# Python linting using ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.2
rev: v0.5.4
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand All @@ -68,7 +68,7 @@ repos:

# Static type checking using mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.1
rev: v1.11.0
hooks:
- id: mypy
files: ^(src/mqt|tests)
Expand Down
12 changes: 4 additions & 8 deletions tests/test_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,8 +1084,7 @@ def test_simulated_annealer_solver_constrained(lambda_strategy: str, constraint_
assert solution.optimal_solution_cost_functions_values() == {"a + b*c + c**2": -0.25} or not all_satisfy
elif constraint_expr == "b <= 1":
assert (
solution.best_solution == {"a": 0.0, "b": 1.0, "c": -0.5}
or solution.best_solution == {"a": 0.0, "b": -1.0, "c": 0.5}
solution.best_solution in ({"a": 0.0, "b": 1.0, "c": -0.5}, {"a": 0.0, "b": -1.0, "c": 0.5})
or not all_satisfy
)
assert (
Expand Down Expand Up @@ -1178,8 +1177,7 @@ def test_simulated_annealer_solver_constrained_lambda_update_mechanism(
assert solution.optimal_solution_cost_functions_values() == {"a + b*c + c**2": -0.25} or not all_satisfy
elif constraint_expr == "b <= 1":
assert (
solution.best_solution == {"a": 0.0, "b": 1.0, "c": -0.5}
or solution.best_solution == {"a": 0.0, "b": -1.0, "c": 0.5}
solution.best_solution in ({"a": 0.0, "b": 1.0, "c": -0.5}, {"a": 0.0, "b": -1.0, "c": 0.5})
or not all_satisfy
)
assert (
Expand Down Expand Up @@ -1380,8 +1378,7 @@ def test_simulated_annealer_solver_constrained_lambda_update_mechanism_and_strat
assert solution.optimal_solution_cost_functions_values() == {"a + b*c + c**2": -0.25} or not all_satisfy
elif constraint_expr == "b <= 1":
assert (
solution.best_solution == {"a": 0.0, "b": 1.0, "c": -0.5}
or solution.best_solution == {"a": 0.0, "b": -1.0, "c": 0.5}
solution.best_solution in ({"a": 0.0, "b": 1.0, "c": -0.5}, {"a": 0.0, "b": -1.0, "c": 0.5})
or not all_satisfy
)
assert (
Expand Down Expand Up @@ -1455,8 +1452,7 @@ def test_simulated_annealing_cost_function_matrix(
all_satisfy, _each_satisfy = solution.check_constraint_optimal_solution()
if constraint_expr == "M1_0_1 >= 1":
assert (
solution.best_solution == {"M1": [[-1, 2]], "M2": [[2], [-1]]}
or solution.best_solution == {"M1": [[2, 2]], "M2": [[-1], [-1]]}
solution.best_solution in ({"M1": [[-1, 2]], "M2": [[2], [-1]]}, {"M1": [[2, 2]], "M2": [[-1], [-1]]})
or not all_satisfy
)
assert (solution.best_energy < -3.9) or not all_satisfy
Expand Down