#NEWLINE# def test_basic_apply( ) : #NEWLINE# #INDENT# n = symbols ( 'n' ) #NEWLINE# e = ( B ( 0 ) * BKet ( [ n ] ) ) #NEWLINE# assert ( apply_operators ( e ) == ( sqrt ( n ) * BKet ( [ ( n - 1 ) ] ) ) ) #NEWLINE# e = ( Bd ( 0 ) * BKet ( [ n ] ) ) #NEWLINE# assert ( apply_operators ( e ) == ( sqrt ( ( n + 1 ) ) * BKet ( [ ( n + 1 ) ] ) ) )