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

Python pytest.deprecated_call函数代码示例

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

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



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

示例1: test_curent_vs_past_spacing

def test_curent_vs_past_spacing():
    with pytest.deprecated_call():
        mg1 = RasterModelGrid(3, 3, spacing=(5, 4))
    with pytest.deprecated_call():
        mg2 = RasterModelGrid(3, 3, xy_spacing=(4, 5))
    assert_array_equal(mg1.x_of_node, mg2.x_of_node)
    assert_array_equal(mg1.y_of_node, mg2.y_of_node)
开发者ID:landlab,项目名称:landlab,代码行数:7,代码来源:test_grid_reference.py


示例2: test_warn_on_deprecated_db_port

 def test_warn_on_deprecated_db_port(self):
     with pytest.deprecated_call():
         validate_config({'MONGODB_HOST': Defaults.MONGODB_HOST,
                          'MONGODB_PORT': 1234})
     with pytest.deprecated_call():
         validate_config({'MONGODB_HOST': Defaults.MONGODB_HOST,
                          'MONGODB_DB': 'udata'})
开发者ID:odtvince,项目名称:udata,代码行数:7,代码来源:test_model.py


示例3: test_signing_with_example_keys

    def test_signing_with_example_keys(self, backend, vector, hash_type):
        curve_type = ec._CURVE_TYPES[vector['curve']]

        _skip_ecdsa_vector(backend, curve_type, hash_type)

        key = ec.EllipticCurvePrivateNumbers(
            vector['d'],
            ec.EllipticCurvePublicNumbers(
                vector['x'],
                vector['y'],
                curve_type()
            )
        ).private_key(backend)
        assert key

        pkey = key.public_key()
        assert pkey

        signer = pytest.deprecated_call(key.signer, ec.ECDSA(hash_type()))
        signer.update(b"YELLOW SUBMARINE")
        signature = signer.finalize()

        verifier = pytest.deprecated_call(
            pkey.verifier, signature, ec.ECDSA(hash_type())
        )
        verifier.update(b"YELLOW SUBMARINE")
        verifier.verify()
开发者ID:cloudera,项目名称:hue,代码行数:27,代码来源:test_ec.py


示例4: test_enable_receiving

 def test_enable_receiving(self, monitor):
     """
     Test that enable_receiving() is deprecated and calls out to start().
     """
     with mock.patch.object(monitor, 'start') as start:
         pytest.deprecated_call(monitor.enable_receiving)
         assert start.called
开发者ID:dwlehman,项目名称:pyudev,代码行数:7,代码来源:test_monitor.py


示例5: test_query_segdb

    def test_query_segdb(self):
        with pytest.deprecated_call():
            result = query_segdb(self.TEST_CLASS.query_segdb,
                                 QUERY_FLAGS[0], 0, 10)
        RESULT = QUERY_RESULT[QUERY_FLAGS[0]]

        assert isinstance(result, self.TEST_CLASS)
        utils.assert_segmentlist_equal(result.known, RESULT.known)
        utils.assert_segmentlist_equal(result.active, RESULT.active)

        with pytest.deprecated_call():
            result2 = query_segdb(self.TEST_CLASS.query_segdb,
                                  QUERY_FLAGS[0], (0, 10))
        utils.assert_flag_equal(result, result2)

        with pytest.deprecated_call():
            result2 = query_segdb(self.TEST_CLASS.query_segdb,
                                  QUERY_FLAGS[0], SegmentList([(0, 10)]))
        utils.assert_flag_equal(result, result2)

        with pytest.deprecated_call():
            with pytest.raises(ValueError):
                self.TEST_CLASS.query_segdb(QUERY_FLAGS[0], 1, 2, 3)
            with pytest.raises(ValueError):
                self.TEST_CLASS.query_segdb(QUERY_FLAGS[0], (1, 2, 3))
开发者ID:gwpy,项目名称:gwpy,代码行数:25,代码来源:test_flag.py


示例6: test_curent_vs_past_origin

def test_curent_vs_past_origin():
    with pytest.deprecated_call():
        mg1 = RasterModelGrid(3, 3, origin=(10, 13))
    with pytest.deprecated_call():
        mg2 = RasterModelGrid(3, 3, xy_of_lower_left=(10, 13))
    assert_array_equal(mg1.x_of_node, mg2.x_of_node)
    assert_array_equal(mg1.y_of_node, mg2.y_of_node)
开发者ID:landlab,项目名称:landlab,代码行数:7,代码来源:test_grid_reference.py


示例7: test_start_container_with_links

    def test_start_container_with_links(self):
        def call_start():
            self.client.start(
                fake_api.FAKE_CONTAINER_ID, links={'path': 'alias'}
            )

        pytest.deprecated_call(call_start)
开发者ID:Khan,项目名称:frankenserver,代码行数:7,代码来源:container_test.py


示例8: test_multicall_deprecated

def test_multicall_deprecated(pm):
    class P1(object):
        @hookimpl
        def m(self, __multicall__, x):
            pass

    pytest.deprecated_call(pm.register, P1())
开发者ID:hpk42,项目名称:pluggy,代码行数:7,代码来源:test_deprecations.py


示例9: testCustomSessionsDir

    def testCustomSessionsDir(
            self, tmpdir, monkeypatch, environment,
            session_args):
        from argparse import Namespace
        from omero.util import get_user_dir
        from path import path

        for var in environment.keys():
            if environment[var]:
                monkeypatch.setenv(var, tmpdir / environment.get(var))
            else:
                monkeypatch.delenv(var, raising=False)

        # args.session_dir sets the sessions dir
        args = Namespace()
        if session_args:
            setattr(args, session_args, tmpdir / session_args)

        if environment.get('OMERO_SESSION_DIR') or session_args:
            pytest.deprecated_call(self.cli.controls['sessions'].store, args)

        store = self.cli.controls['sessions'].store(args)
        # By order of precedence
        if environment.get('OMERO_SESSIONDIR'):
            sdir = path(tmpdir) / environment.get('OMERO_SESSIONDIR')
        elif environment.get('OMERO_SESSION_DIR'):
            sdir = (path(tmpdir) / environment.get('OMERO_SESSION_DIR') /
                    'omero' / 'sessions')
        elif session_args:
            sdir = path(getattr(args, session_args)) / 'omero' / 'sessions'
        elif environment.get('OMERO_USERDIR'):
            sdir = path(tmpdir) / environment.get('OMERO_USERDIR') / 'sessions'
        else:
            sdir = path(get_user_dir()) / 'omero' / 'sessions'
        assert store.dir == sdir
开发者ID:Daniel-Walther,项目名称:openmicroscopy,代码行数:35,代码来源:test_sessions.py


示例10: test_median_mean

def test_median_mean(lal_func, pycbc_func):
    """Check that the registered "median-mean" method works

    Should resolve in this order to

    - ``pycbc_median_mean``
    - ``lal_median_mean``
    - `KeyError`
    """
    # first call goes to pycbc
    with pytest.deprecated_call() as record:
        fft_median_mean.median_mean(1, 2, 3)
    try:
        assert len(record) == 2  # once for pycbc, once for mm
    except TypeError:  # pytest < 3.9.1
        pass
    else:
        assert "pycbc_median_mean" in record[-1].message.args[0]
        assert pycbc_func.called_with(1, 2, 3)

    # second call goes to lal
    with pytest.deprecated_call() as record:
        fft_median_mean.median_mean(1, 2, 3)
    try:
        assert len(record) == 3  # once for pycbc, once for lal, once for mm
    except TypeError:  # pytest < 3.9.1
        pass
    else:
        assert "lal_median_mean" in record[-1].message.args[0]
        assert lal_func.called_with(1, 2, 3)

    # third call errors
    with pytest.deprecated_call(), pytest.raises(KeyError):
        fft_median_mean.median_mean(1, 2, 3)
开发者ID:diegobersanetti,项目名称:gwpy,代码行数:34,代码来源:test_spectral_median_mean.py


示例11: test_deprecated_call_supports_match

    def test_deprecated_call_supports_match(self):
        with pytest.deprecated_call(match=r"must be \d+$"):
            warnings.warn("value must be 42", DeprecationWarning)

        with pytest.raises(pytest.fail.Exception):
            with pytest.deprecated_call(match=r"must be \d+$"):
                warnings.warn("this is not here", DeprecationWarning)
开发者ID:nicoddemus,项目名称:pytest,代码行数:7,代码来源:test_recwarn.py


示例12: test_object_depracation_warnings

def test_object_depracation_warnings(recwarn):
    class MyObject(BaseObject):
        pass

    obj = MyObject()
    pytest.deprecated_call(obj.from_dict, {})
    pytest.deprecated_call(obj.to_dict)
开发者ID:rshk,项目名称:contracts,代码行数:7,代码来源:test_base_models.py


示例13: test_verify_false_deprecated

    def test_verify_false_deprecated(self, jws, recwarn):
        example_jws = (
            b'eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9'
            b'.eyJoZWxsbyI6ICJ3b3JsZCJ9'
            b'.tvagLDLoaiJKxOKqpBXSEGy7SYSifZhjntgm9ctpyj8')

        pytest.deprecated_call(jws.decode, example_jws, verify=False)
开发者ID:aviars,项目名称:pyjwt,代码行数:7,代码来源:test_api_jws.py


示例14: test_deprecated_call_specificity

 def test_deprecated_call_specificity(self):
     other_warnings = [Warning, UserWarning, SyntaxWarning, RuntimeWarning,
                       FutureWarning, ImportWarning, UnicodeWarning]
     for warning in other_warnings:
         f = lambda: py.std.warnings.warn(warning("hi"))
         with pytest.raises(AssertionError):
             pytest.deprecated_call(f)
开发者ID:yosriayed,项目名称:GSM-scanner,代码行数:7,代码来源:test_recwarn.py


示例15: test_create_dsa_signature_ctx

 def test_create_dsa_signature_ctx(self):
     params = dsa.DSAParameters.generate(1024, backend)
     key = dsa.DSAPrivateKey.generate(params, backend)
     pytest.deprecated_call(
         backend.create_dsa_signature_ctx,
         key,
         hashes.SHA1()
     )
开发者ID:bdpayne,项目名称:cryptography,代码行数:8,代码来源:test_openssl.py


示例16: test_deprecated_methods

def test_deprecated_methods():
    env = TrueSkill()
    r1, r2, r3 = Rating(), Rating(), Rating()
    deprecated_call(transform_ratings, [(r1,), (r2,), (r3,)])
    deprecated_call(match_quality, [(r1,), (r2,), (r3,)])
    deprecated_call(env.transform_ratings, [(r1,), (r2,), (r3,)])
    deprecated_call(env.match_quality, [(r1,), (r2,), (r3,)])
    deprecated_call(env.Rating)
开发者ID:gyril,项目名称:BA55,代码行数:8,代码来源:trueskilltests.py


示例17: test_start_container_with_lxc_conf

    def test_start_container_with_lxc_conf(self):
        def call_start():
            self.client.start(
                fake_api.FAKE_CONTAINER_ID,
                lxc_conf={'lxc.conf.k': 'lxc.conf.value'}
            )

        pytest.deprecated_call(call_start)
开发者ID:Khan,项目名称:frankenserver,代码行数:8,代码来源:container_test.py


示例18: test_create_rsa_signature_ctx

 def test_create_rsa_signature_ctx(self):
     private_key = rsa.RSAPrivateKey.generate(65537, 512, backend)
     pytest.deprecated_call(
         backend.create_rsa_signature_ctx,
         private_key,
         padding.PKCS1v15(),
         hashes.SHA1()
     )
开发者ID:bdpayne,项目名称:cryptography,代码行数:8,代码来源:test_openssl.py


示例19: test_find_edf_events_deprecation

def test_find_edf_events_deprecation():
    """Test find_edf_events deprecation."""
    raw = read_raw_edf(edf_path)
    with pytest.deprecated_call(match="find_edf_events"):
        raw.find_edf_events()

    with pytest.deprecated_call(match="find_edf_events"):
        find_edf_events(raw)
开发者ID:adykstra,项目名称:mne-python,代码行数:8,代码来源:test_edf.py


示例20: test_start_container_with_lxc_conf_compat

    def test_start_container_with_lxc_conf_compat(self):
        def call_start():
            self.client.start(
                fake_api.FAKE_CONTAINER_ID,
                lxc_conf=[{'Key': 'lxc.conf.k', 'Value': 'lxc.conf.value'}]
            )

        pytest.deprecated_call(call_start)
开发者ID:Khan,项目名称:frankenserver,代码行数:8,代码来源:container_test.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python pytest.exit函数代码示例发布时间:2022-05-27
下一篇:
Python pytest.debug_func函数代码示例发布时间: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