test_utils.py 文件源码

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

项目:xphyle 作者: jdidion 项目源码 文件源码
def test_rolling_fileoutput_write(self):
        path = self.root.make_file()
        with textoutput(
                path + '{index}.txt', file_output_type=RollingFileOutput,
                lines_per_file=3) as out:
            for i in range(6):
                out.write(i, False)
            for ch in ('a', 'b', 'c'):
                out.write(ch, False)
            out.write("d\ne\nf")
        with open(path + '0.txt', 'rt') as infile:
            self.assertEqual('0\n1\n2\n', infile.read())
        with open(path + '1.txt', 'rt') as infile:
            self.assertEqual('3\n4\n5\n', infile.read())
        with open(path + '2.txt', 'rt') as infile:
            self.assertEqual('a\nb\nc\n', infile.read())
        with open(path + '3.txt', 'rt') as infile:
            self.assertEqual('d\ne\nf\n', infile.read())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号