class_docstr: Test that the sample_state function works as expected
class_docstr_tok: ["Test","that","the","sample_state","function","works","as","expected"]
docstr: Tests that entangled qubits are always in the same state.
docstr_tok: ["Tests","that","entangled","qubits","are","always","in","the","same","state","."]
code: def test_entangled_qubit_samples_always_match(self):
      """Tests that entangled qubits are always in the same state."""
      bell_state = np.array([[1, 0], [0, 1]]) / np.sqrt(2)
      samples = sample_state(bell_state, 1000)
      assert samples.shape == (1000, 2)
      assert not any(
          samples[:, 0] ^ samples[:, 1]
      )  # all samples are entangled
      assert not all(samples[:, 0])  # some samples are |00>
      assert any(samples[:, 0])
  
imports: from random import shuffle
  import pytest
  import numpy
  import pennylane
  from pennylane.devices.qubit import simulate
  from pennylane.devices.qubit.simulate import _FlexShots
  from pennylane.devices.qubit import sample_state, measure_with_samples
  from pennylane.devices.qubit.sampling import _sample_state_jax
  from pennylane.measurements import Shots
label_desc: Use image node_id 8 for calling the TestSampleState obj's underlying member method code with example usage: obj.test_entangled_qubit_samples_always_match() without return types