def test_file_io_rewrite_read(temp_file): fileio = FileIO(temp_file) content1 = "message 1\n" fileio.write(content1) assert fileio.read() == content1 content2 = "message 2\n" fileio.rewrite(content2) assert fileio.read(position=0) == content2
def test_file_io_rewrite_read(tc_unittest): temp_file = tc_unittest.get_temp_file() fileio = FileIO(temp_file) content1 = "message 1\n" fileio.write(content1) assert fileio.read() == content1 content2 = "message 2\n" fileio.rewrite(content2) assert fileio.read(position=0) == content2