def test_qubit_state_vector(self, device, init_state, tol, skip_if):
    'Test QubitStateVector initialisation.'
    n_wires = 1
    dev = device(n_wires)
    skip_if(dev, {'returns_probs': False})
    rnd_state = init_state(n_wires)

    @qml.qnode(dev)
    def circuit():
        qml.QubitStateVector(rnd_state, wires=range(n_wires))
        return qml.probs(range(n_wires))
    res = circuit()
    expected = (np.abs(rnd_state) ** 2)
    assert np.allclose(res, expected, atol=tol(dev.shots))
Test QubitStateVector initialisation.
def test_qubit_state_vector(self, device, init_state, tol, skip_if):
    
    n_wires = 1
    dev = device(n_wires)
    skip_if(dev, {'returns_probs': False})
    rnd_state = init_state(n_wires)

    @qml.qnode(dev)
    def circuit():
        qml.QubitStateVector(rnd_state, wires=range(n_wires))
        return qml.probs(range(n_wires))
    res = circuit()
    expected = (np.abs(rnd_state) ** 2)
    assert np.allclose(res, expected, atol=tol(dev.shots))