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 shadow_expval returns an empty array when the state has
  NaN values
docstr_tok: ["Test","that","shadow_expval","returns","an","empty","array","when","the","state","has","NaN","values"]
code: def test_nan_shadow_expval(self, H, interface, shots):
      """Test that shadow_expval returns an empty array when the state has
      NaN values"""
      state = qml.math.full((2, 2), np.NaN, like=interface)
      res = measure_with_samples(
          (qml.shadow_expval(H),),
          state,
          _FlexShots(shots),
          is_state_batched=False,
      )
  
      if not isinstance(shots, list):
          assert isinstance(res, tuple)
          res = res[0]
          assert qml.math.shape(res) == qml.math.shape(H)
          assert qml.math.all(qml.math.isnan(res))
  
      else:
          assert isinstance(res, tuple)
          assert len(res) == 2
          for r in res:
              assert isinstance(r, tuple)
              r = r[0]
              assert qml.math.shape(r) == qml.math.shape(H)
              assert qml.math.all(qml.math.isnan(r))
  
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 5 for calling the TestInvalidStateSamples obj's underlying member method code with example usage: obj.test_nan_shadow_expval(H, interface, shots) without return types