def test_contains_basic(): assert Contains(2, S.Integers) is S.true assert Contains(-2, S.Naturals) is S.false i = Symbol('i', integer=True) assert Contains(i, S.Naturals) == Contains(i, S.Naturals, evaluate=False) assert S.Naturals0.contains(x) == Contains(x, S.Naturals0, evaluate=False)
def test_rationals(): Q = S.Rationals assert 5 in Q assert -5 in Q assert Rational(1, 3) in Q assert pi not in Q assert Q.contains(x) == Contains(x, Q, evaluate=False) assert Q.inf == -oo assert Q.sup == oo assert Q.boundary == Q assert (list(itertools.islice(S.Rationals, 17)) == [ Integer(0), Integer(1), Rational(1, 2), Rational(1, 3), Integer(-1), Rational(-1, 2), Rational(-1, 3), Rational(1, 4), Rational(-1, 4), Integer(2), Rational(2, 3), Rational(1, 5), Rational(-1, 5), Rational(2, 5), Integer(-2), Rational(-2, 3), Rational(-2, 5) ])
def test_sympyissue_6194(): assert Contains(x, Interval(0, 1)) == (x >= 0) & (x <= 1) assert Contains(x, FiniteSet(0)) != S.false assert Contains(x, Interval(1, 1)) != S.false assert Contains(x, S.Integers) != S.false