当前位置: 首页>>代码示例>>Python>>正文


Python pytest.deprecated_call函数代码示例

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


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


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