class_docstr: Test creating expansion functions from stopping criteria.
class_docstr_tok: ["Test","creating","expansion","functions","from","stopping","criteria","."]
docstr: Test that passing a device ensures that all operations are expanded
  to match the devices default gate set
docstr_tok: ["Test","that","passing","a","device","ensures","that","all","operations","are","expanded","to","match","the","devices","default","gate","set"]
code: def test_device_only_expansion(self):
      """Test that passing a device ensures that all operations are expanded
      to match the devices default gate set"""
      dev = qml.device("default.qubit.legacy", wires=1)
      expand_fn = qml.transforms.create_expand_fn(device=dev, depth=10)
  
      with qml.queuing.AnnotatedQueue() as q:
          qml.U1(0.2, wires=0)
          qml.Rot(
              *qml.numpy.array([0.5, 0.2, -0.1], requires_grad=True),
              wires=0,
          )
  
      tape = qml.tape.QuantumScript.from_queue(q)
      new_tape = expand_fn(tape)
  
      assert len(new_tape.operations) == 2
      assert new_tape.operations[0].name == "U1"
      assert new_tape.operations[1].name == "Rot"
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane.wires import Wires
label_desc: Use image node_id 5 for calling the TestCreateExpandFn obj's underlying member method code with example usage: obj.test_device_only_expansion() without return types