Here are the examples of the python api pytest.deprecated_call taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
25 Examples
3
Example 1
def test_alias():
polygons = os.path.join(DATA, 'polygons.shp')
stats = zonal_stats(polygons, raster)
stats2 = raster_stats(polygons, raster)
assert stats == stats2
pytest.deprecated_call(raster_stats, polygons, raster)
3
Example 2
def test_transform():
with rasterio.open(raster) as src:
arr = src.read(1)
affine = src.affine
polygons = os.path.join(DATA, 'polygons.shp')
stats = zonal_stats(polygons, arr, affine=affine)
stats2 = zonal_stats(polygons, arr, transform=affine.to_gdal())
assert stats == stats2
pytest.deprecated_call(zonal_stats, polygons, raster, transform=affine.to_gdal())
3
Example 3
Project: pyudev Source File: test_monitor.py
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
3
Example 4
Project: pyudev Source File: test_monitor.py
def test_receive_device(self, monitor):
"""
Test that Monitor.receive_device is deprecated and calls out to
poll(), which in turn is tested by test_poll.
"""
with mock.patch.object(monitor, 'poll') as poll:
device = mock.Mock(name='device')
device.action = 'spam'
poll.return_value = device
event = pytest.deprecated_call(monitor.receive_device)
assert event[0] == 'spam'
assert event[1] is device
3
Example 5
Project: pyudev Source File: _device_tests.py
@given(strategies.sampled_from(_DEVICES))
@settings(max_examples=5)
def test_traverse(self, a_device):
child = a_device
for parent in pytest.deprecated_call(a_device.traverse):
assert parent == child.parent
child = parent
3
Example 6
Project: django-rest-framework-jwt Source File: test_utils.py
def test_jwt_payload_handler(self):
payload = utils.jwt_payload_handler(self.user)
pytest.deprecated_call(utils.jwt_payload_handler, self.user)
self.assertTrue(isinstance(payload, dict))
self.assertEqual(payload['user_id'], self.user.pk)
self.assertEqual(payload['email'], self.email)
self.assertEqual(payload['username'], self.username)
self.assertTrue('exp' in payload)
3
Example 7
Project: pyjwt Source File: test_api_jws.py
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)
3
Example 8
Project: pyjwt Source File: test_api_jwt.py
def test_decode_with_verify_expiration_kwarg(self, jwt, payload):
payload['exp'] = utc_timestamp() - 1
secret = 'secret'
jwt_message = jwt.encode(payload, secret)
pytest.deprecated_call(
jwt.decode,
jwt_message,
secret,
verify_expiration=False
)
with pytest.raises(ExpiredSignatureError):
pytest.deprecated_call(
jwt.decode,
jwt_message,
secret,
verify_expiration=True
)
3
Example 9
Project: flask-jwt Source File: test_jwt.py
def test_custom_auth_handler():
def custom_auth_request_handler():
return jsonify({'hello': 'world'})
jwt = flask_jwt.JWT()
pytest.deprecated_call(jwt.auth_request_handler, custom_auth_request_handler)
app = Flask(__name__)
jwt.init_app(app)
with app.test_client() as c:
resp, jdata = post_json(c, '/auth', {})
assert jdata == {'hello': 'world'}
3
Example 10
Project: opbeat_python Source File: client_tests.py
def test_async_arg_deprecation(self):
pytest.deprecated_call(
Client,
servers=['http://example.com'],
organization_id='organization_id',
app_id='app_id',
secret_token='secret',
async=True,
)
3
Example 11
Project: opbeat_python Source File: django_tests.py
def test_ASYNC_config_raises_deprecation(self):
config = {
'ORGANIZATION_ID': '1',
'APP_ID': '1',
'SECRET_TOKEN': '1',
'ASYNC': True,
}
with self.settings(OPBEAT=config):
pytest.deprecated_call(get_client_config)
0
Example 12
Project: cryptography Source File: test_asym_utils.py
def test_deprecated_rfc6979_signature():
sig = pytest.deprecated_call(encode_rfc6979_signature, 1, 1)
assert sig == b"0\x06\x02\x01\x01\x02\x01\x01"
decoded = pytest.deprecated_call(decode_rfc6979_signature, sig)
assert decoded == (1, 1)
0
Example 13
Project: pytest Source File: deprecated_test.py
def test_getfuncargvalue_is_deprecated(request):
pytest.deprecated_call(request.getfuncargvalue, 'tmpdir')
0
Example 14
def test_deprecated_call(self):
pytest.deprecated_call(self.dep, 0, 5)
0
Example 15
def test_deprecated_call_ret(self):
ret = pytest.deprecated_call(self.dep, 0)
assert ret == 42
0
Example 16
def test_deprecated_explicit_call(self):
pytest.deprecated_call(self.dep_explicit, 0)
pytest.deprecated_call(self.dep_explicit, 0)
0
Example 17
Project: pytest Source File: test_recwarn.py
def test_deprecated_call_as_context_manager(self):
with pytest.deprecated_call():
self.dep(0)
0
Example 18
Project: pytest Source File: test_recwarn.py
def test_deprecated_call_pending(self):
def f():
py.std.warnings.warn(PendingDeprecationWarning("hi"))
pytest.deprecated_call(f)
0
Example 19
Project: korean Source File: koreantests.py
def test_deprecated_patch_gettext(self):
t = deprecated_call(l10n.patch_gettext, self.generate_translations())
_, ngettext = self.gettext_functions(t)
assert isinstance(_(''), l10n.Template)
0
Example 20
Project: korean Source File: koreantests.py
def test_deprecated_jinja2_ext_location(self):
from jinja2 import Environment
old_ext_name = 'korean.l10n.jinja2ext.proofread'
env = deprecated_call(Environment, extensions=[old_ext_name])
assert 'proofread' in env.filters
0
Example 21
Project: translate Source File: test_dtd.py
def test_getouput_deprecated(self):
dtdfile = self.dtdparse('<!ENTITY test.me "bananas for sale">\n')
assert dtdfile.getoutput() == bytes(dtdfile)
deprecated_call(dtdfile.getoutput)
0
Example 22
Project: tossi Source File: test.py
def test_deprecations():
pytest.deprecated_call(registry.postfix_particle, u'테스트', u'으로부터')
0
Example 23
Project: vcversioner Source File: test_vcversioner.py
def test_git_args_deprecation(gitdir):
"git_args is deprecated."
pytest.deprecated_call(vcversioner.find_version, git_args=['git', 'spam'], Popen=basic_version)
0
Example 24
Project: vcrpy Source File: test_request.py
def test_add_header_deprecated():
req = Request('GET', 'http://go.com/', '', {})
pytest.deprecated_call(req.add_header, 'foo', 'bar')
assert req.headers == {'foo': 'bar'}
0
Example 25
Project: marshmallow Source File: test_serialization.py
def test_function_field_passed_func_is_deprecated(self):
pytest.deprecated_call(lambda: fields.Function(func=lambda obj: obj.name.upper()))