def test_should_write_file_does_exist(tmpdir, patch_input, interactive, no_overwrite, user_input, expected):
target_file = tmpdir.join('target')
target_file.write(b'')
patch_input.return_value = user_input
kwargs = GOOD_IOHANDLER_KWARGS.copy()
kwargs.update(dict(
interactive=interactive,
no_overwrite=no_overwrite
))
handler = io_handling.IOHandler(**kwargs)
should_write = handler._should_write_file(str(target_file))
if expected:
assert should_write
else:
assert not should_write
test_io_handling.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录