Skip to content

Commit

Permalink
Update tests due to the deprecated qml.sample usage when `shots=Non…
Browse files Browse the repository at this point in the history
…e` (#132)

* fix test_apply.py errors where the number of shots was not set explicitly

* get PL master temporarily

* Update requirements.txt
  • Loading branch information
antalszava committed Aug 16, 2021
1 parent 333ed09 commit 864ea2c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ def test_sample_values(self, qubit_device_2_wires, tol):
# initialized during reset
qubit_device_2_wires.reset()

qubit_device_2_wires.shots = 1000
qubit_device_2_wires.apply([qml.RX(1.5708, wires=[0])])
qubit_device_2_wires._wires_measured = {0}
qubit_device_2_wires._samples = qubit_device_2_wires.generate_samples()
Expand Down Expand Up @@ -996,6 +997,7 @@ def test_multi_samples_return_correlated_results(self, qubit_device_2_wires):
"""

dev = qubit_device_2_wires
dev.shots = 1000

@qml.qnode(dev)
def circuit():
Expand All @@ -1015,7 +1017,7 @@ def test_multi_samples_return_correlated_results_more_wires_than_size_of_observa
the correct dimensions
"""

dev = qml.device("lightning.qubit", wires=num_wires)
dev = qml.device("lightning.qubit", wires=num_wires, shots=1000)

@qml.qnode(dev)
def circuit():
Expand Down Expand Up @@ -1237,7 +1239,7 @@ def test_pauliz_hadamard(
)

dev._wires_measured = {0, 1, 2}
dev._samples = dev.generate_samples() if shots is not None else None
dev._samples = dev.generate_samples() if dev.shots is not None else None

s1 = obs.eigvals
p = dev.marginal_prob(dev.probability(), wires=obs.wires)
Expand Down

0 comments on commit 864ea2c

Please sign in to comment.