Skip to content

Commit

Permalink
replace magic number with computed
Browse files Browse the repository at this point in the history
  • Loading branch information
natestemen committed Nov 5, 2024
1 parent c2eb37c commit 961e743
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mitiq/lre/tests/test_lre.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Unit tests for the LRE extrapolation methods."""

import math
import random
import re
from unittest.mock import Mock
Expand Down Expand Up @@ -47,6 +48,7 @@ def test_lre_all_qprogram(circuit_type):
"""Verify LRE works with all supported frontends."""
degree, fold_multiplier = 2, 3
circuit = benchmarks.generate_ghz_circuit(3, circuit_type)
depth = 3 # not all circuit types have a simple way to compute depth

mock_executor = Mock(side_effect=lambda _: random.random())

Expand All @@ -58,7 +60,7 @@ def test_lre_all_qprogram(circuit_type):
)

assert isinstance(lre_exp_val, float)
assert mock_executor.call_count == 10
assert mock_executor.call_count == math.comb(degree + depth, degree)


@pytest.mark.parametrize("degree, fold_multiplier", [(2, 2), (2, 3), (3, 4)])
Expand Down

0 comments on commit 961e743

Please sign in to comment.