def test_lt_gt():
from sympy import sympify as S
x, y = Symbol('x'), Symbol('y')
assert (x >= y) == GreaterThan(x, y)
assert (x >= 0) == GreaterThan(x, 0)
assert (x <= y) == LessThan(x, y)
assert (x <= 0) == LessThan(x, 0)
assert (0 <= x) == GreaterThan(x, 0)
assert (0 >= x) == LessThan(x, 0)
assert (S(0) >= x) == GreaterThan(0, x)
assert (S(0) <= x) == LessThan(0, x)
assert (x > y) == StrictGreaterThan(x, y)
assert (x > 0) == StrictGreaterThan(x, 0)
assert (x < y) == StrictLessThan(x, y)
assert (x < 0) == StrictLessThan(x, 0)
assert (0 < x) == StrictGreaterThan(x, 0)
assert (0 > x) == StrictLessThan(x, 0)
assert (S(0) > x) == StrictGreaterThan(0, x)
assert (S(0) < x) == StrictLessThan(0, x)
e = x**2 + 4*x + 1
assert (e >= 0) == GreaterThan(e, 0)
assert (0 <= e) == GreaterThan(e, 0)
assert (e > 0) == StrictGreaterThan(e, 0)
assert (0 < e) == StrictGreaterThan(e, 0)
assert (e <= 0) == LessThan(e, 0)
assert (0 >= e) == LessThan(e, 0)
assert (e < 0) == StrictLessThan(e, 0)
assert (0 > e) == StrictLessThan(e, 0)
assert (S(0) >= e) == GreaterThan(0, e)
assert (S(0) <= e) == LessThan(0, e)
assert (S(0) < e) == StrictLessThan(0, e)
assert (S(0) > e) == StrictGreaterThan(0, e)
评论列表
文章目录