#NEWLINE# def test_canonical( ) : #NEWLINE# #INDENT# one = S ( 1 ) #NEWLINE# def unchanged( v ) : #NEWLINE# #INDENT# c = v . canonical #NEWLINE# return ( v . is_Relational and c . is_Relational and ( v == c ) ) #NEWLINE# #UNINDENT# def isreversed( v ) : #NEWLINE# #INDENT# return ( v . canonical == v . reversed ) #NEWLINE# #UNINDENT# assert unchanged ( ( x < one ) ) #NEWLINE# assert unchanged ( ( x <= one ) ) #NEWLINE# assert isreversed ( Eq ( one , x , evaluate = False ) ) #NEWLINE# assert unchanged ( Eq ( x , one , evaluate = False ) ) #NEWLINE# assert isreversed ( Ne ( one , x , evaluate = False ) ) #NEWLINE# assert unchanged ( Ne ( x , one , evaluate = False ) ) #NEWLINE# assert unchanged ( ( x >= one ) ) #NEWLINE# assert unchanged ( ( x > one ) ) #NEWLINE# assert unchanged ( ( x < y ) ) #NEWLINE# assert unchanged ( ( x <= y ) ) #NEWLINE# assert isreversed ( Eq ( y , x , evaluate = False ) ) #NEWLINE# assert unchanged ( Eq ( x , y , evaluate = False ) ) #NEWLINE# assert isreversed ( Ne ( y , x , evaluate = False ) ) #NEWLINE# assert unchanged ( Ne ( x , y , evaluate = False ) ) #NEWLINE# assert isreversed ( ( x >= y ) ) #NEWLINE# assert isreversed ( ( x > y ) ) #NEWLINE# assert ( ( ( - x ) < 1 ) . canonical == ( x > ( - 1 ) ) ) #NEWLINE# assert isreversed ( ( ( - x ) > y ) )