def test_is_writable(): with open_file(iarpath, mode="r") as f: assert not is_writable(f) with open_file(iarpath, mode="a") as f: assert is_writable(f)
def test_open_file_no_overwrite(): with pytest.raises(FileExistsError): open_file(rawpath, mode="w", overwrite=False)
def test_open_file_wrong_path(wrong_path: str): with pytest.raises(FileNotFoundError): open_file(wrong_path)
def test_open_file_append(): with open_file(iarpath, mode="a") as f: assert not f.readable() assert f.writable() assert f.closed
def test_open_file_read(): with open_file(iarpath) as f: assert f.readable() assert not f.writable() assert f.closed