fixture.py 文件源码

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

项目:reahl 作者: reahl 项目源码 文件源码
def __getattr__(self, name):
        if name.startswith(self.factory_method_prefix):
            raise AttributeError(name)

        factory = self.get_factory_method_for(name)
        if inspect.isgeneratorfunction(factory):
            with self.wrapped_attribute_error():
                generator = factory()
                instance = next(generator)
            self.attribute_generators.append(generator)
        else:
            with self.wrapped_attribute_error():
                instance = factory()

        setattr(self, name, instance)
        self.attributes_set[name] = instance
        return instance
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号