Ejemplo n.º 1
0
def test_numbers():
    x = symbol('x', 'real')
    y = symbol('y', 'int')
    for expr in [x + 1, x - 1, x * 1, x + y, x - y, x / y, x * y + x + y,
                 x**y, x**2, 2**x, x % 5, -x,
                 sin(x), cos(x ** 2), exp(log(y))]:
        assert expr.dshape == dshape('real')
        assert eval(str(expr)).isidentical(expr)

    assert (-y).dshape == dshape('int')
Ejemplo n.º 2
0
def test_numbers():
    x = symbol('x', 'real')
    y = symbol('y', 'int')
    for expr in [x + 1, x - 1, x * 1, x + y, x - y, x / y, x * y + x + y,
                 x**y, x**2, 2**x, x % 5, -x,
                 sin(x), cos(x ** 2), exp(log(y))]:
        assert expr.dshape == dshape('real')
        assert eval(str(expr)).isidentical(expr)

    assert (-y).dshape == dshape('int')
Ejemplo n.º 3
0
def test_numbers():
    x = symbol("x", "real")
    y = symbol("y", "int")
    for expr in [
        x + 1,
        x - 1,
        x * 1,
        x + y,
        x - y,
        x / y,
        x * y + x + y,
        x ** y,
        x ** 2,
        2 ** x,
        x % 5,
        -x,
        sin(x),
        cos(x ** 2),
        exp(log(y)),
    ]:
        assert expr.dshape == dshape("real")
        assert eval(str(expr)).isidentical(expr)

    assert (-y).dshape == dshape("int")