#NEWLINE# def test_WGate( ) : #NEWLINE# #INDENT# nqubits = 2 #NEWLINE# basis_states = superposition_basis ( nqubits ) #NEWLINE# assert ( qapply ( ( WGate ( nqubits ) * basis_states ) ) == basis_states ) #NEWLINE# expected = ( ( ( 2 / sqrt ( pow ( 2 , nqubits ) ) ) * basis_states ) - IntQubit ( 1 , nqubits ) ) #NEWLINE# assert ( qapply ( ( WGate ( nqubits ) * IntQubit ( 1 , nqubits ) ) ) == expected )