#NEWLINE# def test_contains( ) : #NEWLINE# #INDENT# assert ( Interval ( 0 , 2 ) . contains ( 1 ) is S . true ) #NEWLINE# assert ( Interval ( 0 , 2 ) . contains ( 3 ) is S . false ) #NEWLINE# assert ( Interval ( 0 , 2 , True , False ) . contains ( 0 ) is S . false ) #NEWLINE# assert ( Interval ( 0 , 2 , True , False ) . contains ( 2 ) is S . true ) #NEWLINE# assert ( Interval ( 0 , 2 , False , True ) . contains ( 0 ) is S . true ) #NEWLINE# assert ( Interval ( 0 , 2 , False , True ) . contains ( 2 ) is S . false ) #NEWLINE# assert ( Interval ( 0 , 2 , True , True ) . contains ( 0 ) is S . false ) #NEWLINE# assert ( Interval ( 0 , 2 , True , True ) . contains ( 2 ) is S . false ) #NEWLINE# assert ( ( Interval ( 0 , 2 ) in Interval ( 0 , 2 ) ) is False ) #NEWLINE# assert ( FiniteSet ( 1 , 2 , 3 ) . contains ( 2 ) is S . true ) #NEWLINE# assert ( FiniteSet ( 1 , 2 , Symbol ( 'x' ) ) . contains ( Symbol ( 'x' ) ) is S . true ) #NEWLINE# from sympy.abc import a , b #NEWLINE# assert isinstance ( FiniteSet ( b ) . contains ( ( - a ) ) , Contains ) #NEWLINE# assert isinstance ( FiniteSet ( b ) . contains ( a ) , Contains ) #NEWLINE# assert isinstance ( FiniteSet ( a ) . contains ( 1 ) , Contains ) #NEWLINE# raises ( TypeError , ( lambda : ( 1 in FiniteSet ( a ) ) ) ) #NEWLINE# rad1 = Pow ( ( Pow ( 2 , ( S ( 1 ) / 3 ) ) - 1 ) , ( S ( 1 ) / 3 ) ) #NEWLINE# rad2 = ( ( Pow ( ( S ( 1 ) / 9 ) , ( S ( 1 ) / 3 ) ) - Pow ( ( S ( 2 ) / 9 ) , ( S ( 1 ) / 3 ) ) ) + Pow ( ( S ( 4 ) / 9 ) , ( S ( 1 ) / 3 ) ) ) #NEWLINE# s1 = FiniteSet ( rad1 ) #NEWLINE# s2 = FiniteSet ( rad2 ) #NEWLINE# assert ( ( s1 - s2 ) == S . EmptySet ) #NEWLINE# items = [ 1 , 2 , S . Infinity , S ( 'ham' ) , ( - 1.1 ) ] #NEWLINE# fset = FiniteSet ( * items ) #NEWLINE# assert all ( ( ( item in fset ) for item in items ) ) #NEWLINE# assert all ( ( ( fset . contains ( item ) is S . true ) for item in items ) ) #NEWLINE# assert ( Union ( Interval ( 0 , 1 ) , Interval ( 2 , 5 ) ) . contains ( 3 ) is S . true ) #NEWLINE# assert ( Union ( Interval ( 0 , 1 ) , Interval ( 2 , 5 ) ) . contains ( 6 ) is S . false ) #NEWLINE# assert ( Union ( Interval ( 0 , 1 ) , FiniteSet ( 2 , 5 ) ) . contains ( 3 ) is S . false ) #NEWLINE# assert ( S . EmptySet . contains ( 1 ) is S . false ) #NEWLINE# assert ( FiniteSet ( rootof ( ( ( ( x ** 3 ) + x ) - 1 ) , 0 ) ) . contains ( S . Infinity ) is S . false ) #NEWLINE# assert ( rootof ( ( ( ( x ** 5 ) + ( x ** 3 ) ) + 1 ) , 0 ) in S . Reals ) #NEWLINE# assert ( not ( rootof ( ( ( ( x ** 5 ) + ( x ** 3 ) ) + 1 ) , 1 ) in S . Reals ) ) #NEWLINE# assert ( Union ( Interval ( 1 , 2 ) , Interval ( 3 , 4 ) ) . contains ( x ) == Or ( And ( ( x <= 2 ) , ( x >= 1 ) ) , And ( ( x <= 4 ) , ( x >= 3 ) ) ) ) #NEWLINE# assert ( Intersection ( Interval ( 1 , x ) , Interval ( 2 , 3 ) ) . contains ( y ) == And ( ( y <= 3 ) , ( y <= x ) , ( y >= 1 ) , ( y >= 2 ) ) )