code: def test_p():
      assert Px.hilbert_space == L2(
          Interval(S.NegativeInfinity, S.Infinity)
      )
      assert qapply(Px * PxKet(px)) == px * PxKet(px)
      assert PxKet(px).dual_class() == PxBra
      assert PxBra(x).dual_class() == PxKet
      assert (Dagger(PxKet(py)) * PxKet(px)).doit() == DiracDelta(
          px - py
      )
      assert (XBra(x) * PxKet(px)).doit() == exp(
          I * x * px / hbar
      ) / sqrt(2 * pi * hbar)
      assert represent(PxKet(px)) == DiracDelta(px - px_1)
  
      rep_x = represent(PxOp(), basis=XOp)
      assert rep_x == -hbar * I * DiracDelta(
          x_1 - x_2
      ) * DifferentialOperator(x_1)
      assert rep_x == represent(PxOp(), basis=XOp())
      assert rep_x == represent(PxOp(), basis=XKet)
      assert rep_x == represent(PxOp(), basis=XKet())
  
      assert represent(
          PxOp() * XKet(), basis=XKet
      ) == -hbar * I * DiracDelta(x - x_2) * DifferentialOperator(x)
      assert represent(
          XBra("y") * PxOp() * XKet(), basis=XKet
      ) == -hbar * I * DiracDelta(x - y) * DifferentialOperator(x)
  
file_path: sympy/sympy/physics/quantum/tests/test_cartesian.py
imports: from sympy.core.numbers import I, pi
  from sympy.core.singleton import S
  from sympy.core.symbol import symbols
  from sympy.functions.elementary.exponential import exp
  from sympy.functions.elementary.miscellaneous import sqrt
  from sympy.functions.special.delta_functions import DiracDelta
  from sympy.sets.sets import Interval
  from sympy.physics.quantum import qapply, represent, L2, Dagger
  from sympy.physics.quantum import Commutator, hbar
  from sympy.physics.quantum.cartesian import XOp, YOp, ZOp, PxOp, X, Y, Z, Px, XKet, XBra, PxKet, PxBra, PositionKet3D, PositionBra3D
  from sympy.physics.quantum.operator import DifferentialOperator
label_desc: Use image node_id 2 for calling a global function with example usage: test_p() without return types