本文整理汇总了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)
示例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'})
示例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()
示例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
示例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))
示例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)
示例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)
示例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())
示例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
示例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)
示例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)
示例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)
示例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)
示例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)
示例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()
)