Example #1
0
def test_global():
    """Test ask with global assumptions"""
    x = symbols('x')
    assert ask(x, Q.integer) == None
    global_assumptions.add(Assume(x, Q.integer))
    assert ask(x, Q.integer) == True
    global_assumptions.clear()
    assert ask(x, Q.integer) == None
Example #2
0
def test_global():
    """Test for global assumptions"""
    global_assumptions.add(Q.is_true(x > 0))
    assert Q.is_true(x > 0) in global_assumptions
    global_assumptions.remove(Q.is_true(x > 0))
    assert not Q.is_true(x > 0) in global_assumptions
    # same with multiple of assumptions
    global_assumptions.add(Q.is_true(x > 0), Q.is_true(y > 0))
    assert Q.is_true(x > 0) in global_assumptions
    assert Q.is_true(y > 0) in global_assumptions
    global_assumptions.clear()
    assert not Q.is_true(x > 0) in global_assumptions
    assert not Q.is_true(y > 0) in global_assumptions
Example #3
0
def test_global():
    """Test for global assumptions"""
    global_assumptions.add(Q.is_true(x > 0))
    assert Q.is_true(x > 0) in global_assumptions
    global_assumptions.remove(Q.is_true(x > 0))
    assert not Q.is_true(x > 0) in global_assumptions
    # same with multiple of assumptions
    global_assumptions.add(Q.is_true(x > 0), Q.is_true(y > 0))
    assert Q.is_true(x > 0) in global_assumptions
    assert Q.is_true(y > 0) in global_assumptions
    global_assumptions.clear()
    assert not Q.is_true(x > 0) in global_assumptions
    assert not Q.is_true(y > 0) in global_assumptions
Example #4
0
def test_global():
    """Test for global assumptions"""
    x, y = symbols('x y')
    global_assumptions.add(Assume(x>0))
    assert Assume(x>0) in global_assumptions
    global_assumptions.remove(Assume(x>0))
    assert not Assume(x>0) in global_assumptions
    # same with multiple of assumptions
    global_assumptions.add(Assume(x>0), Assume(y>0))
    assert Assume(x>0) in global_assumptions
    assert Assume(y>0) in global_assumptions
    global_assumptions.clear()
    assert not Assume(x>0) in global_assumptions
    assert not Assume(y>0) in global_assumptions
def test_global():
    """Test for global assumptions"""
    x, y = symbols('x y')
    global_assumptions.add(Assume(x > 0))
    assert Assume(x > 0) in global_assumptions
    global_assumptions.remove(Assume(x > 0))
    assert not Assume(x > 0) in global_assumptions
    # same with multiple of assumptions
    global_assumptions.add(Assume(x > 0), Assume(y > 0))
    assert Assume(x > 0) in global_assumptions
    assert Assume(y > 0) in global_assumptions
    global_assumptions.clear()
    assert not Assume(x > 0) in global_assumptions
    assert not Assume(y > 0) in global_assumptions