test_config.py 文件源码

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

项目:shanghai 作者: chireiden 项目源码 文件源码
def test_fileloading(self, sample_yaml):
        # Cannot use tempfile.NamedTemporaryFile because of Windows's file locks
        fd, fname = tempfile.mkstemp('w')
        try:
            with open(fd, 'w', encoding='utf-8') as f:
                ryaml.dump(sample_yaml, f)
            config = ShanghaiConfiguration.from_filename(fname)
        finally:
            os.remove(fname)

        assert config.mapping == sample_yaml
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号