Skip to content

Commit

Permalink
forgot to add the test
Browse files Browse the repository at this point in the history
  • Loading branch information
daknuett committed Mar 27, 2020
1 parent 16cf9ac commit 782f3d1
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/test_clear_gate_cache.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from pyqcs import H, S, clear_builtin_gate_cache
from pyqcs.gates.builtins import _H, _S


def test_cache_is_active():
gates_S = [S(i) for i in range(10)]
gates_H = [H(i) for i in range(20)]

for s in gates_S:
assert s in _S._registry.values()

for h in gates_H:
assert h in _H._registry.values()

def test_clear_cache():
gates_S = [S(i) for i in range(10)]
gates_H = [H(i) for i in range(20)]

clear_builtin_gate_cache()

assert _S._registry == {}
assert _H._registry == {}

0 comments on commit 782f3d1

Please sign in to comment.