• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pytest.skip函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sympy.utilities.pytest.skip函数的典型用法代码示例。如果您正苦于以下问题:Python skip函数的具体用法?Python skip怎么用?Python skip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了skip函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_benchmark_czichowski

def test_benchmark_czichowski():
    skip('This takes too much time (without gmpy)')

    config.setup('GB_METHOD', 'f5b')
    helper_test_benchmark_czichowski()
    config.setup('GB_METHOD', 'buchberger')
    helper_test_benchmark_czichowski()
开发者ID:aeberspaecher,项目名称:sympy,代码行数:7,代码来源:test_groebnertools.py


示例2: test_scipy_fns

def test_scipy_fns():
    if not scipy:
        skip("scipy not installed")

    single_arg_sympy_fns = [erf, erfc, factorial, gamma, loggamma, digamma]
    single_arg_scipy_fns = [scipy.special.erf, scipy.special.erfc,
        scipy.special.factorial, scipy.special.gamma, scipy.special.gammaln,
        scipy.special.psi]
    numpy.random.seed(0)
    for (sympy_fn, scipy_fn) in zip(single_arg_sympy_fns, single_arg_scipy_fns):
        test_values = 20 * numpy.random.rand(20)
        f = lambdify(x, sympy_fn(x), modules = "scipy")
        assert numpy.all(abs(f(test_values) - scipy_fn(test_values)) < 1e-15)

    double_arg_sympy_fns = [RisingFactorial, besselj, bessely, besseli,
        besselk]
    double_arg_scipy_fns = [scipy.special.poch, scipy.special.jn,
        scipy.special.yn, scipy.special.iv, scipy.special.kn]

    #suppress scipy warnings
    import warnings
    warnings.filterwarnings('ignore', '.*floating point number truncated*')

    for (sympy_fn, scipy_fn) in zip(double_arg_sympy_fns, double_arg_scipy_fns):
        for i in range(20):
            test_values = 20 * numpy.random.rand(2)
            f = lambdify((x,y), sympy_fn(x,y), modules = "scipy")
            assert abs(f(*test_values) - scipy_fn(*test_values)) < 1e-15
开发者ID:cmarqu,项目名称:sympy,代码行数:28,代码来源:test_lambdify.py


示例3: test_scalar_numpy

def test_scalar_numpy():
    if not np:
        skip("numpy not installed or Python too old.")

    assert represent(Integer(1), format='numpy') == 1
    assert represent(Float(1.0), format='numpy') == 1.0
    assert represent(1.0+I, format='numpy') == 1.0+1.0j
开发者ID:101man,项目名称:sympy,代码行数:7,代码来源:test_represent.py


示例4: test_numpy_matrix

def test_numpy_matrix():
    if not numpy:
        skip("numpy not installed.")
    A = Matrix([[x, x*y], [sin(z) + 4, x**z]])
    sol_arr = numpy.array([[1, 2], [numpy.sin(3) + 4, 1]])
    #Lambdify array first, to ensure return to array as default
    f = lambdify((x, y, z), A, ['numpy'])
    numpy.testing.assert_allclose(f(1, 2, 3), sol_arr)
    #Check that the types are arrays and matrices
    assert isinstance(f(1, 2, 3), numpy.ndarray)

    # gh-15071
    class dot(Function):
        pass
    x_dot_mtx = dot(x, Matrix([[2], [1], [0]]))
    f_dot1 = lambdify(x, x_dot_mtx)
    inp = numpy.zeros((17, 3))
    assert numpy.all(f_dot1(inp) == 0)

    strict_kw = dict(allow_unknown_functions=False, inline=True, fully_qualified_modules=False)
    p2 = NumPyPrinter(dict(user_functions={'dot': 'dot'}, **strict_kw))
    f_dot2 = lambdify(x, x_dot_mtx, printer=p2)
    assert numpy.all(f_dot2(inp) == 0)

    p3 = NumPyPrinter(strict_kw)
    # The line below should probably fail upon construction (before calling with "(inp)"):
    raises(Exception, lambda: lambdify(x, x_dot_mtx, printer=p3)(inp))
开发者ID:cmarqu,项目名称:sympy,代码行数:27,代码来源:test_lambdify.py


示例5: test_issue_15827

def test_issue_15827():
    if not numpy:
        skip("numpy not installed")
    A = MatrixSymbol("A", 3, 3)
    f = lambdify(A, 2*A)
    assert numpy.array_equal(f(numpy.array([[1, 2, 3], [1, 2, 3], [1, 2, 3]])), \
    numpy.array([[2, 4, 6], [2, 4, 6], [2, 4, 6]]))
开发者ID:cklb,项目名称:sympy,代码行数:7,代码来源:test_lambdify.py


示例6: test_issue_13924

def test_issue_13924():
    if not numpy:
        skip("numpy not installed.")

    a = sympify(numpy.array([1]))
    assert isinstance(a, ImmutableDenseNDimArray)
    assert a[0] == 1
开发者ID:aprasanna,项目名称:sympy,代码行数:7,代码来源:test_sympify.py


示例7: test_chronos_cg

def test_chronos_cg():
    skip("Test takes too long")
    delta_1, omega_2, pi_1, pi_2, mu_12 = map(lambda x: Tensor(x, rank=0), \
        ['delta_1', 'omega_2', 'pi_1', 'pi_2', 'mu_12'])
    r_1, r_2, q_1, q_2, p_1, p_2, x_1, x_2 = map(lambda x: Tensor(x, rank=1), \
        ['r_1', 'r_2', 'q_1', 'q_2', 'p_1', 'p_2', 'x_1', 'x_2'])
    A, R_0, P_0 = map(lambda x: Tensor(x, rank=2), ['A', 'R_0', 'P_0'])

    # Specify which variables are known
    knowns = [pi_1, p_1, r_1, q_1, x_1, A, R_0, P_0]

    # Now try the chronos variant and repeat.
    chronos_eqns = [r_2 - r_1 - delta_1 * q_1,
                q_2 - A * p_2,
                p_2 - r_2 + p_1 * mu_12,
                q_2 - A * r_2 + q_1 * mu_12,
                x_2 - x_1 - delta_1 * p_1,
                omega_2 - T(r_2) * r_2,
                pi_2 - T(p_2) * A * p_2,
                T(R_0) * r_2,
                T(r_1) * r_2,
                T(P_0) * A * p_2,
                T(p_1) * A * p_2,
                T(p_2) * A * p_2 - T(r_2) * A * r_2 + T(mu_12) * pi_1 * mu_12,
                ]
    run_cg_algorithms(chronos_eqns, knowns)
开发者ID:IgnitionProject,项目名称:ignition,代码行数:26,代码来源:test_iterative_methods.py


示例8: test_valued_tensor_self_contraction

def test_valued_tensor_self_contraction():
    numpy = import_module("numpy")
    if numpy is None:
        skip("numpy not installed.")

    assert AB(i0, -i0) == 4
    assert BA(i0, -i0) == 2
开发者ID:MarcdeFalco,项目名称:sympy,代码行数:7,代码来源:test_tensor.py


示例9: test_issue_15265

def test_issue_15265():
    from sympy.core.sympify import sympify
    from sympy.core.singleton import S

    matplotlib = import_module('matplotlib', min_module_version='1.1.0', catch=(RuntimeError,))
    if not matplotlib:
        skip("Matplotlib not the default backend")

    x = Symbol('x')
    eqn = sin(x)

    p = plot(eqn, xlim=(-S.Pi, S.Pi), ylim=(-1, 1))
    p._backend.close()

    p = plot(eqn, xlim=(-1, 1), ylim=(-S.Pi, S.Pi))
    p._backend.close()

    p = plot(eqn, xlim=(-1, 1), ylim=(sympify('-3.14'), sympify('3.14')))
    p._backend.close()

    p = plot(eqn, xlim=(sympify('-3.14'), sympify('3.14')), ylim=(-1, 1))
    p._backend.close()

    raises(ValueError,
        lambda: plot(eqn, xlim=(-S.ImaginaryUnit, 1), ylim=(-1, 1)))

    raises(ValueError,
        lambda: plot(eqn, xlim=(-1, 1), ylim=(-1, S.ImaginaryUnit)))

    raises(ValueError,
        lambda: plot(eqn, xlim=(-S.Infinity, 1), ylim=(-1, 1)))

    raises(ValueError,
        lambda: plot(eqn, xlim=(-1, 1), ylim=(-1, S.Infinity)))
开发者ID:Lenqth,项目名称:sympy,代码行数:34,代码来源:test_plot.py


示例10: test_issue_4540

def test_issue_4540():
    if ON_TRAVIS:
        skip("Too slow for travis.")
    # Note, this integral is probably nonelementary
    assert not integrate(
        (sin(1/x) - x*exp(x)) /
        ((-sin(1/x) + x*exp(x))*x + x*sin(1/x)), x).has(Integral)
开发者ID:KonstantinTogoi,项目名称:sympy,代码行数:7,代码来源:test_failing_integrals.py


示例11: test_benchmark_coloring

def test_benchmark_coloring():
    skip('takes too much time')

    V = range(1, 12+1)
    E = [(1,2),(2,3),(1,4),(1,6),(1,12),(2,5),(2,7),(3,8),(3,10),
         (4,11),(4,9),(5,6),(6,7),(7,8),(8,9),(9,10),(10,11),
         (11,12),(5,12),(5,9),(6,10),(7,11),(8,12),(3,4)]

    V = [Symbol('x' + str(i)) for i in V]
    E = [(V[i-1], V[j-1]) for i, j in E]

    x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12 = V

    I3 = [x**3 - 1 for x in V]
    Ig = [x**2 + x*y + y**2 for x, y in E]

    I = I3 + Ig

    assert groebner(I[:-1], V, order='lex') == [
        x1 + x11 + x12,
        x2 - x11,
        x3 - x12,
        x4 - x12,
        x5 + x11 + x12,
        x6 - x11,
        x7 - x12,
        x8 + x11 + x12,
        x9 - x11,
        x10 + x11 + x12,
        x11**2 + x11*x12 + x12**2,
        x12**3 - 1,
    ]

    assert groebner(I, V, order='lex') == [1]
开发者ID:pernici,项目名称:sympy,代码行数:34,代码来源:test_groebnertools.py


示例12: test_mellin_transform_fail

def test_mellin_transform_fail():
    skip("Risch takes forever.")

    from sympy import Max, Min
    MT = mellin_transform

    bpos = symbols('b', positive=True)
    bneg = symbols('b', negative=True)

    expr = (sqrt(x + b**2) + b)**a/sqrt(x + b**2)
    # TODO does not work with bneg, argument wrong. Needs changes to matching.
    assert MT(expr.subs(b, -bpos), x, s) == \
        ((-1)**(a + 1)*2**(a + 2*s)*bpos**(a + 2*s - 1)*gamma(a + s)
         *gamma(1 - a - 2*s)/gamma(1 - s),
            (-re(a), -re(a)/2 + S(1)/2), True)

    expr = (sqrt(x + b**2) + b)**a
    assert MT(expr.subs(b, -bpos), x, s) == \
        (
            2**(a + 2*s)*a*bpos**(a + 2*s)*gamma(-a - 2*
                   s)*gamma(a + s)/gamma(-s + 1),
            (-re(a), -re(a)/2), True)

    # Test exponent 1:
    assert MT(expr.subs({b: -bpos, a: 1}), x, s) == \
        (-bpos**(2*s + 1)*gamma(s)*gamma(-s - S(1)/2)/(2*sqrt(pi)),
            (-1, -S(1)/2), True)
开发者ID:FedericoV,项目名称:sympy,代码行数:27,代码来源:test_transforms.py


示例13: test_issue_15827

def test_issue_15827():
    if not numpy:
        skip("numpy not installed")
    A = MatrixSymbol("A", 3, 3)
    B = MatrixSymbol("B", 2, 3)
    C = MatrixSymbol("C", 3, 4)
    D = MatrixSymbol("D", 4, 5)
    k=symbols("k")
    f = lambdify(A, (2*k)*A)
    g = lambdify(A, (2+k)*A)
    h = lambdify(A, 2*A)
    i = lambdify((B, C, D), 2*B*C*D)
    assert numpy.array_equal(f(numpy.array([[1, 2, 3], [1, 2, 3], [1, 2, 3]])), \
    numpy.array([[2*k, 4*k, 6*k], [2*k, 4*k, 6*k], [2*k, 4*k, 6*k]], dtype=object))

    assert numpy.array_equal(g(numpy.array([[1, 2, 3], [1, 2, 3], [1, 2, 3]])), \
    numpy.array([[k + 2, 2*k + 4, 3*k + 6], [k + 2, 2*k + 4, 3*k + 6], \
    [k + 2, 2*k + 4, 3*k + 6]], dtype=object))

    assert numpy.array_equal(h(numpy.array([[1, 2, 3], [1, 2, 3], [1, 2, 3]])), \
    numpy.array([[2, 4, 6], [2, 4, 6], [2, 4, 6]]))

    assert numpy.array_equal(i(numpy.array([[1, 2, 3], [1, 2, 3]]), numpy.array([[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]]), \
    numpy.array([[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5]])), numpy.array([[ 120, 240, 360, 480, 600], \
    [ 120, 240, 360, 480, 600]]))
开发者ID:asmeurer,项目名称:sympy,代码行数:25,代码来源:test_lambdify.py


示例14: test_numpy_translation_abs

def test_numpy_translation_abs():
    if not numpy:
        skip("numpy not installed.")

    f = lambdify(x, Abs(x), "numpy")
    assert f(-1) == 1
    assert f(1) == 1
开发者ID:KonstantinTogoi,项目名称:sympy,代码行数:7,代码来源:test_lambdify.py


示例15: test_issue_10295

def test_issue_10295():
    if not numpy:
        skip("numpy not installed.")

    A = numpy.array([[1, 3, -1],
                     [0, 1, 7]])
    sA = S(A)
    assert sA.shape == (2, 3)
    for (ri, ci), val in numpy.ndenumerate(A):
        assert sA[ri, ci] == val

    B = numpy.array([-7, x, 3*y**2])
    sB = S(B)
    assert B[0] == -7
    assert B[1] == x
    assert B[2] == 3*y**2

    C = numpy.arange(0, 24)
    C.resize(2,3,4)
    sC = S(C)
    assert sC[0, 0, 0].is_integer
    assert sC[0, 0, 0] == 0

    a1 = numpy.array([1, 2, 3])
    a2 = numpy.array([i for i in range(24)])
    a2.resize(2, 4, 3)
    assert sympify(a1) == ImmutableDenseNDimArray([1, 2, 3])
    assert sympify(a2) == ImmutableDenseNDimArray([i for i in range(24)], (2, 4, 3))
开发者ID:baoqchau,项目名称:sympy,代码行数:28,代码来源:test_sympify.py


示例16: test_valued_tensor_applyfunc

def test_valued_tensor_applyfunc():
    numpy = import_module("numpy")
    if numpy is None:
        skip("numpy not installed.")

    aA = A(i0).applyfunc(lambda x: x**2)
    aB = B(i0).applyfunc(lambda x: x**3)
    aB2 = B(-i0).applyfunc(lambda x: x**3)

    for i in range(4):
        assert aA[i] == A(i0)[i]**2
        assert aB[i] == B(i1)[i]**3
    assert aB*aB2 == -794

    tA = A.applyfunc(lambda x: x + 33)
    tB = B.applyfunc(lambda x: x + 33)
    tAB = AB.applyfunc(lambda x: x + 33)

    assert (tA(i0)*tA(-i0)).expand() == ((E + 33)**2 - (px + 33)**2 - (py + 33)**2 - (pz + 33)**2).expand()
    assert tB(i0).get_matrix() == Matrix([33, 34, 35, 36])
    assert tAB(i0, i1).get_matrix() == Matrix([
        [34, 33, 33, 33],
        [33, 32, 33, 33],
        [33, 33, 32, 33],
        [33, 33, 33, 32],
    ])
开发者ID:MarcdeFalco,项目名称:sympy,代码行数:26,代码来源:test_tensor.py


示例17: test_valued_non_diagonal_metric

def test_valued_non_diagonal_metric():
    numpy = import_module("numpy")
    if numpy is None:
        skip("numpy not installed.")

    mmatrix = Matrix(ndm_matrix)
    assert NA(n0)*NA(-n0) == (NA(n0).get_matrix().T * mmatrix * NA(n0).get_matrix())[0, 0]
开发者ID:MarcdeFalco,项目名称:sympy,代码行数:7,代码来源:test_tensor.py


示例18: test_matplotlib

def test_matplotlib():
    matplotlib = import_module('matplotlib', min_module_version='1.1.0', catch=(RuntimeError,))
    if matplotlib:
        plot_implicit_tests('test')
        test_line_color()
    else:
        skip("Matplotlib not the default backend")
开发者ID:A-turing-machine,项目名称:sympy,代码行数:7,代码来源:test_plot_implicit.py


示例19: test_numpy_array_arg

def test_numpy_array_arg():
    # Test for issue 14655 (numpy part)
    if not numpy:
        skip("numpy not installed")

    f = lambdify([[x, y]], x*x + y, 'numpy')

    assert f(numpy.array([2.0, 1.0])) == 5
开发者ID:KonstantinTogoi,项目名称:sympy,代码行数:8,代码来源:test_lambdify.py


示例20: test_tensorflow_relational

def test_tensorflow_relational():
    if not tensorflow:
        skip("tensorflow not installed.")
    expr = x >= 0
    func = lambdify(x, expr, modules="tensorflow")
    a = tensorflow.placeholder(dtype=tensorflow.float32)
    s = tensorflow.Session()
    assert func(a).eval(session=s, feed_dict={a: 1})
开发者ID:KonstantinTogoi,项目名称:sympy,代码行数:8,代码来源:test_lambdify.py



注:本文中的sympy.utilities.pytest.skip函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python randtest.randcplx函数代码示例发布时间:2022-05-27
下一篇:
Python pytest.raises函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap