Ejemplo n.º 1
0
def test_issue1447():
    # using list(...) so py.test can recalculate values
    tests = list(
        cartes([cot, tan], [-pi / 2, 0, pi / 2, pi, 3 * pi / 2], ['-', '+']))
    results = (0, 0, -oo, oo, 0, 0, -oo, oo, 0, 0, oo, -oo, 0, 0, oo, -oo, 0,
               0, oo, -oo)
    assert len(tests) == len(results)
    for i, (args, res) in enumerate(zip(tests, results)):
        f, l, d = args
        eq = f(x)
        try:
            assert limit(eq, x, l, dir=d) == res
        except AssertionError:
            if 0:  # change to 1 if you want to see the failing tests
                print
                print i, res, eq, l, d, limit(eq, x, l, dir=d)
            else:
                assert None
Ejemplo n.º 2
0
def test_issue1447():
    # using list(...) so py.test can recalculate values
    tests = list(cartes([cot, tan],
                        [-pi/2, 0, pi/2, pi, 3*pi/2],
                        ['-', '+']))
    results = (0, 0, -oo, oo, 0, 0, -oo, oo, 0, 0,
               oo, -oo, 0, 0, oo, -oo, 0, 0, oo, -oo)
    assert len(tests) == len(results)
    for i, (args, res) in enumerate(zip(tests, results)):
        f, l, d= args
        eq=f(x)
        try:
            assert limit(eq, x, l, dir=d) == res
        except AssertionError:
            if 0: # change to 1 if you want to see the failing tests
                print
                print i, res, eq, l, d, limit(eq, x, l, dir=d)
            else:
                assert None
Ejemplo n.º 3
0
def test_issue2084():
    # using list(...) so py.test can recalculate values
    tests = list(
        cartes([x, -x], [-1, 1],
               [2, 3, Rational(1, 2), Rational(2, 3)], ['-', '+']))
    results = (oo, oo, -oo, oo, -oo * I, oo, -oo * (-1)**Rational(1, 3), oo, 0,
               0, 0, 0, 0, 0, 0, 0, oo, oo, oo, -oo, oo, -oo * I, oo,
               -oo * (-1)**Rational(1, 3), 0, 0, 0, 0, 0, 0, 0, 0)
    assert len(tests) == len(results)
    for i, (args, res) in enumerate(zip(tests, results)):
        y, s, e, d = args
        eq = y**(s * e)
        try:
            assert limit(eq, x, 0, dir=d) == res
        except AssertionError:
            if 0:  # change to 1 if you want to see the failing tests
                print
                print i, res, eq, d, limit(eq, x, 0, dir=d)
            else:
                assert None
Ejemplo n.º 4
0
def test_issue2084():
    # using list(...) so py.test can recalculate values
    tests = list(cartes([x, -x],
                        [-1, 1],
                        [2, 3, Rational(1, 2), Rational(2, 3)],
                        ['-', '+']))
    results = (oo, oo, -oo, oo, -oo*I, oo, -oo*(-1)**Rational(1, 3), oo,
               0, 0, 0, 0, 0, 0, 0, 0,
               oo, oo, oo, -oo, oo, -oo*I, oo, -oo*(-1)**Rational(1, 3),
               0, 0, 0, 0, 0, 0, 0, 0)
    assert len(tests) == len(results)
    for i, (args, res) in enumerate(zip(tests, results)):
        y, s, e, d = args
        eq=y**(s*e)
        try:
            assert limit(eq, x, 0, dir=d) == res
        except AssertionError:
            if 0: # change to 1 if you want to see the failing tests
                print
                print i, res, eq, d, limit(eq, x, 0, dir=d)
            else:
                assert None