stubble.py 文件源码

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

项目:reahl 作者: reahl 项目源码 文件源码
def __get__(self, instance, owner):
        assert issubclass(owner, Stub), 'stubbed methods belong in Stub classes...'
        assert instance, 'implemented for instance methods only'
        real_method = getattr(owner.stubbed, self.stub.__name__)
        assert isinstance(real_method.im_func, types.FunctionType), 'stubbed methods are for methods...'
        real_args = inspect.getargspec(real_method.im_func)
        stub_args = inspect.getargspec(self.stub)
        assert real_args == stub_args, 'argument specification mismatch'

        return six.create_bound_method(self.stub, instance)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号