<s> from sympy import Symbol , Dummy , Rational , exp <EOL> def test_equal ( ) : <EOL> b = Symbol ( "<STR_LIT:b>" ) <EOL> a = Symbol ( "<STR_LIT:a>" ) <EOL> e1 = a + b <EOL> e2 = <NUM_LIT:2> * a * b <EOL> e3 = a ** <NUM_LIT:3> * b ** <NUM_LIT:2> <EOL> e4 = a * b + b * a <EOL> assert not e1 == e2 <EOL> assert not e1 == e2 <EOL> assert e1 != e2 <EOL> assert e2 == e4 <EOL> assert e2 != e3 <EOL> assert not e2 == e3 <EOL> x = Symbol ( "<STR_LIT:x>" ) <EOL> e1 = exp ( x + <NUM_LIT:1> / x ) <EOL> y = Symbol ( "<STR_LIT:x>" ) <EOL> e2 = exp ( y + <NUM_LIT:1> / y ) <EOL> assert e1 == e2 <EOL> assert not e1 != e2 <EOL> y = Symbol ( "<STR_LIT:y>" ) <EOL> e2 = exp ( y + <NUM_LIT:1> / y ) <EOL> assert not e1 == e2 <EOL> assert e1 != e2 <EOL> e5 = Rational ( <NUM_LIT:3> ) + <NUM_LIT:2> * x - x - x <EOL> assert e5 == <NUM_LIT:3> <EOL> assert <NUM_LIT:3> == e5 <EOL> assert e5 != <NUM_LIT:4> <EOL> assert <NUM_LIT:4> != e5 <EOL> assert e5 != <NUM_LIT:3> + x <EOL> assert <NUM_LIT:3> + x != e5 <EOL> def test_expevalbug ( ) : <EOL> x = Symbol ( "<STR_LIT:x>" ) <EOL> e1 = exp ( <NUM_LIT:1> * x ) <EOL> e3 = exp ( x ) <EOL> assert e1 == e3 <EOL> def test_cmp_bug1 ( ) : <EOL> class T ( object ) : <EOL> pass <EOL> t = T ( ) <EOL> x = Symbol ( "<STR_LIT:x>" ) <EOL> assert not ( x == t ) <EOL> assert ( x != t ) <EOL> def test_cmp_bug2 ( ) : <EOL> class T ( object ) : <EOL> pass <EOL> t = T ( ) <EOL> assert not ( Symbol == t ) <EOL> assert ( Symbol != t ) <EOL> def test_cmp_issue_4357 ( ) : <EOL> """<STR_LIT>""" <EOL> assert not ( Symbol == <NUM_LIT:1> ) <EOL> assert ( Symbol != <NUM_LIT:1> ) <EOL> assert not ( Symbol == '<STR_LIT:x>' ) <EOL> assert ( Symbol != '<STR_LIT:x>' ) <EOL> def test_dummy_eq ( ) : <EOL> x = Symbol ( '<STR_LIT:x>' ) <EOL> y = Symbol ( '<STR_LIT:y>' ) <EOL> u = Dummy ( '<STR_LIT:u>' ) <EOL> assert ( u ** <NUM_LIT:2> + <NUM_LIT:1> ) . dummy_eq ( x ** <NUM_LIT:2> + <NUM_LIT:1> ) is True <EOL> assert ( ( u ** <NUM_LIT:2> + <NUM_LIT:1> ) == ( x ** <NUM_LIT:2> + <NUM_LIT:1> ) ) is False <EOL> assert ( u ** <NUM_LIT:2> + y ) . dummy_eq ( x ** <NUM_LIT:2> + y , x ) is True <EOL> assert ( u ** <NUM_LIT:2> + y ) . dummy_eq ( x ** <NUM_LIT:2> + y , y ) is False </s>
