test_basic.py 文件源码

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

项目:properties 作者: aranzgeo 项目源码 文件源码
def test_backwards_compat(self):

        with warnings.catch_warnings(record=True) as w:

            class NewProperty(properties.Property):
                info_text = 'new property'

                def info(self):
                    return self.info_text

            assert len(w) == 2
            assert issubclass(w[0].category, FutureWarning)

            np = NewProperty('')

            assert getattr(np, 'class_info', None) == 'new property'
            assert getattr(np, 'info', None) == 'new property'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号