python类deprecated_call()的实例源码

test_recwarn.py 文件源码 项目:GSM-scanner 作者: yosriayed 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def test_invalid_enter_exit(self):
        # wrap this test in WarningsRecorder to ensure warning state gets reset
        with WarningsRecorder():
            with pytest.raises(RuntimeError):
                rec = WarningsRecorder()
                rec.__exit__(None, None, None)  # can't exit before entering

            with pytest.raises(RuntimeError):
                rec = WarningsRecorder()
                with rec:
                    with rec:
                        pass  # can't enter twice

#
# ============ test pytest.deprecated_call() ==============
#
test_ssl.py 文件源码 项目:2FAssassin 作者: maxwellkoh 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def test_load_client_ca_unicode(self, context, ca_file):
        """
        Passing the path as unicode raises a warning but works.
        """
        pytest.deprecated_call(
            context.load_client_ca, ca_file.decode("ascii")
        )
test_ssl.py 文件源码 项目:2FAssassin 作者: maxwellkoh 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_set_session_id_unicode(self, context):
        """
        `Context.set_session_id` raises a warning if a unicode string is
        passed.
        """
        pytest.deprecated_call(context.set_session_id, u"abc")
test.py 文件源码 项目:tossi 作者: what-studio 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def test_deprecations():
    pytest.deprecated_call(registry.postfix_particle, u'???', u'????')
    pytest.deprecated_call(tossi.postfix_particle, u'???', u'????')
    pytest.deprecated_call(tossi.get_particle, u'????')
test_tmpdir.py 文件源码 项目:GSM-scanner 作者: yosriayed 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def test_ensuretemp(recwarn):
    #pytest.deprecated_call(pytest.ensuretemp, 'hello')
    d1 = pytest.ensuretemp('hello')
    d2 = pytest.ensuretemp('hello')
    assert d1 == d2
    assert d1.check(dir=1)
test_recwarn.py 文件源码 项目:GSM-scanner 作者: yosriayed 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def test_deprecated_call_raises(self):
        excinfo = pytest.raises(AssertionError,
                                "pytest.deprecated_call(dep, 3)")
        assert str(excinfo).find("did not produce") != -1
test_recwarn.py 文件源码 项目:GSM-scanner 作者: yosriayed 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def test_deprecated_call(self):
        pytest.deprecated_call(dep, 0)
test_recwarn.py 文件源码 项目:GSM-scanner 作者: yosriayed 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def test_deprecated_call_ret(self):
        ret = pytest.deprecated_call(dep, 0)
        assert ret == 42
test_recwarn.py 文件源码 项目:GSM-scanner 作者: yosriayed 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def test_deprecated_explicit_call(self):
        pytest.deprecated_call(dep_explicit, 0)
        pytest.deprecated_call(dep_explicit, 0)
test_recwarn.py 文件源码 项目:GSM-scanner 作者: yosriayed 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def test_deprecated_call_pending(self):
        f = lambda: py.std.warnings.warn(PendingDeprecationWarning("hi"))
        pytest.deprecated_call(f)
test_recwarn.py 文件源码 项目:GSM-scanner 作者: yosriayed 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
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)
test_warning.py 文件源码 项目:py 作者: pytest-dev 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def test_forwarding_to_warnings_module():
    pytest.deprecated_call(py.log._apiwarn, "1.3", "..")
test_deprecation.py 文件源码 项目:scikit-optimize 作者: scikit-optimize 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
def test_n_random_starts_Optimizer():
    # n_random_starts got renamed in v0.4
    et = ExtraTreesRegressor(random_state=2)
    with pytest.deprecated_call():
        Optimizer([(0, 1.)], et, n_random_starts=10, acq_optimizer='sampling')


问题


面经


文章

微信
公众号

扫码关注公众号