class_docstr: Unit tests for transpile function
class_docstr_tok: ["Unit","tests","for","transpile","function"]
docstr: Test that if the state is default mixed, state measurements are converted in to density measurements with the device wires.
docstr_tok: ["Test","that","if","the","state","is","default","mixed",",","state","measurements","are","converted","in","to","density","measurements","with","the","device","wires","."]
code: def test_transpile_with_state_default_mixed(self):
      """Test that if the state is default mixed, state measurements are converted in to density measurements with the device wires."""
  
      dev = qml.device("default.mixed", wires=(0, 1, 2))
  
      tape = qml.tape.QuantumScript(
          [qml.PauliX(0), qml.CNOT(wires=(0, 2))], [qml.state()]
      )
      batch, fn = qml.transforms.transpile(
          tape, coupling_map=[(0, 1), (1, 2)], device=dev
      )
  
      assert batch[0][-1] == qml.density_matrix(wires=(0, 2, 1))
  
      original_results = dev.execute(tape)
      transformed_results = fn(dev.batch_execute(batch))
      assert qml.math.allclose(original_results, transformed_results)
  
imports: from math import isclose
  import pytest
  from pennylane import numpy
  import pennylane
  from pennylane.transforms.transpile import transpile
label_desc: Use image node_id 15 for calling the TestTranspile obj's underlying member method code with example usage: obj.test_transpile_with_state_default_mixed() without return types