class_docstr: Tests for state vectors containing nan values or shot vectors with zero shots.
class_docstr_tok: ["Tests","for","state","vectors","containing","nan","values","or","shot","vectors","with","zero","shots","."]
docstr: Test that errors are only caught if they are raised due to nan values in the state.
docstr_tok: ["Test","that","errors","are","only","caught","if","they","are","raised","due","to","nan","values","in","the","state","."]
code: def test_only_catch_nan_errors(self, shots):
      """Test that errors are only caught if they are raised due to nan values in the state."""
      state = np.zeros((2, 2)).astype(np.complex128)
      mp = qml.expval(qml.PauliZ(0))
      _shots = Shots(shots)
  
      with pytest.raises(
          ValueError, match="probabilities do not sum to 1"
      ):
          _ = measure_with_samples([mp], state, _shots)
  
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 1 for calling the TestInvalidStateSamples obj's underlying member method code with example usage: obj.test_only_catch_nan_errors(shots) without return types