test_deprecation.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:deprecation 作者: briancurtin 项目源码 文件源码
def test_DeprecatedWarning_not_raised(self):
        ret_val = "lololol"

        class Test(object):
            @deprecation.deprecated(deprecated_in="2.0",
                                    removed_in="3.0",
                                    current_version="1.0")
            def method(self):
                """method docstring"""
                return ret_val

        with warnings.catch_warnings(record=True):
            # If a warning is raised it'll be an exception, so we'll fail.
            warnings.simplefilter("error")

            sot = Test()
            self.assertEqual(sot.method(), ret_val)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号