class_docstr: Tests for the projector observable.
class_docstr_tok: ["Tests","for","the","projector","observable","."]
docstr: Tests that Projector is pickle-able.
docstr_tok: ["Tests","that","Projector","is","pickle-able","."]
code: def test_serialization(self):
      """Tests that Projector is pickle-able."""
      # Basis state projector
      proj = qml.Projector([1], wires=[0], id="Timmy")
      serialization = pickle.dumps(proj)
      new_proj = pickle.loads(serialization)
      assert type(new_proj) is type(proj)
      assert qml.equal(new_proj, proj)
      assert new_proj.id == proj.id  # Ensure they are identical
  
      # State vector projector
      proj = qml.Projector([0, 1], wires=[0])
      serialization = pickle.dumps(proj)
      new_proj = pickle.loads(serialization)
  
      assert type(new_proj) is type(proj)
      assert qml.equal(new_proj, proj)
      assert new_proj.id == proj.id
  
imports: import functools
  import pickle
  import pytest
  import numpy
  from gate_data import I, X, Y, Z, H
  import pennylane
  from pennylane.ops.qubit.observables import BasisStateProjector, StateVectorProjector
label_desc: Use image node_id 6 for calling the TestProjector obj's underlying member method code with example usage: obj.test_serialization() without return types