Skip to content

Commit 4c9b2da

Browse files
classiqdorNadavClassiq
authored andcommitted
Add tests for 2 notebooks (bernstein_vazirani and hidden_shift)
1 parent 6aff2ce commit 4c9b2da

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from tests.utils_for_testbook import (
2+
validate_quantum_program_size,
3+
validate_quantum_model,
4+
wrap_testbook,
5+
)
6+
from testbook.client import TestbookNotebookClient
7+
8+
9+
@wrap_testbook("bernstein_vazirani", timeout_seconds=20)
10+
def test_bernstein_vazirani(tb: TestbookNotebookClient) -> None:
11+
# test models
12+
validate_quantum_model(tb.ref("qmod"))
13+
# test quantum programs
14+
validate_quantum_program_size(tb.ref("qprog"), expected_width=6, expected_depth=5)
15+
16+
# test notebook content
17+
assert int(tb.ref("secret_integer_q")) == tb.ref("SECRET_INT")
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from tests.utils_for_testbook import (
2+
validate_quantum_program_size,
3+
validate_quantum_model,
4+
wrap_testbook,
5+
)
6+
from testbook.client import TestbookNotebookClient
7+
8+
9+
@wrap_testbook(
10+
"hidden_shift",
11+
timeout_seconds=272, # we may lower this value
12+
)
13+
def test_hidden_shift(tb: TestbookNotebookClient) -> None:
14+
# test models
15+
validate_quantum_model(tb.ref("qmod_simple"))
16+
validate_quantum_model(tb.ref("qmod_complex"))
17+
validate_quantum_model(tb.ref("qmod_no_dual"))
18+
# test quantum programs
19+
validate_quantum_program_size(
20+
tb.ref("qprog_simple"),
21+
expected_width=7, # actual width: 7
22+
expected_depth=50, # actual depth: 47
23+
)
24+
validate_quantum_program_size(
25+
tb.ref("qprog_complex"),
26+
expected_width=20, # actual width: 20
27+
expected_depth=1700, # actual depth: 1656
28+
)
29+
validate_quantum_program_size(
30+
tb.ref("qprog_no_dual"),
31+
expected_width=20, # actual width: 20
32+
expected_depth=1700, # actual depth: 1685
33+
)
34+
# test notebook content
35+
pass # TODO

0 commit comments

Comments
 (0)