#NEWLINE# def test_normal_order( ) : #NEWLINE# #INDENT# a = BosonOp ( 'a' ) #NEWLINE# b = BosonOp ( 'b' ) #NEWLINE# c = FermionOp ( 'c' ) #NEWLINE# d = FermionOp ( 'd' ) #NEWLINE# assert ( normal_order ( ( a * Dagger ( a ) ) ) == ( Dagger ( a ) * a ) ) #NEWLINE# assert ( normal_order ( ( Dagger ( a ) * a ) ) == ( Dagger ( a ) * a ) ) #NEWLINE# assert ( normal_order ( ( a * ( Dagger ( a ) ** 2 ) ) ) == ( ( Dagger ( a ) ** 2 ) * a ) ) #NEWLINE# assert ( normal_order ( ( c * Dagger ( c ) ) ) == ( ( - Dagger ( c ) ) * c ) ) #NEWLINE# assert ( normal_order ( ( Dagger ( c ) * c ) ) == ( Dagger ( c ) * c ) ) #NEWLINE# assert ( normal_order ( ( c * ( Dagger ( c ) ** 2 ) ) ) == ( ( Dagger ( d ) ** 2 ) * c ) )