Pete Shadbolt 8 år sedan
förälder
incheckning
277f6a2d4f
1 ändrade filer med 3 tillägg och 3 borttagningar
  1. +3
    -3
      tests/test_measurement.py

+ 3
- 3
tests/test_measurement.py Visa fil

@@ -6,6 +6,7 @@ from tqdm import tqdm
import random
import itertools as it


def test_single_qubit_measurements():
""" Various simple tests of measurements """

@@ -26,6 +27,7 @@ def test_single_qubit_measurements():
g.act_local_rotation(0, "pz")
assert g.measure(0, "px") == 1, "Measuring |-> in X gives 1"


def test_type():
""" Test that the output is always an int """
for r, m, f in it.product(range(24), ("px", "py", "pz"), (0, 1)):
@@ -36,7 +38,6 @@ def test_type():
assert g.measure(0, m, f, detail=True)["determinate"] == True



def test_random_outcomes():
""" Testing random behaviour """
ones = 0
@@ -46,6 +47,7 @@ def test_random_outcomes():
ones += g.measure(0, "pz")
assert 400 < ones < 600, "This is a probabilistic test!"


def test_projection():
""" Test that projection works correctly """
g = GraphState([0])
@@ -58,5 +60,3 @@ def test_projection():
g.act_local_rotation(0, "hadamard")
g.measure(0, "pz", 1)
assert np.allclose(g.to_state_vector().state, qi.one)



Laddar…
Avbryt
Spara