def test_touch_create_file(): url = urlsplit("test/toto/touch.txt") assert not exists(url) touch(url) assert exists(url) remove(url) assert not exists(url)
def test_write_binary_content(): url = urlsplit("test/toto/testwrite.txt") assert not exists(url) write(url, "toto was here", binary=True) assert exists(url) assert read(url, binary=True) == "toto was here" remove(url)
def test_touch_do_not_raise_error_if_dir_part_of_pth_do_not_exist(): url = urlsplit("takapouet/touch.txt") assert touch(url) assert exists(urlsplit("takapouet")) assert exists(urlsplit("takapouet/")) assert exists(url) rmtree("takapouet")
def test_write_content_create_file_if_needed(): url = urlsplit("test/toto/testwrite.txt") assert not exists(url) write(url, "toto was here") assert exists(url) assert read(url) == "toto was here" remove(url)
def test_remove_remove_file(): url = urlsplit("test/tugudu/touch.txt") assert not exists(url) touch(url) assert exists(url) remove(url) assert not exists(url)
def test_remove_dir_remove_all_tree(): url = urlsplit("test/tugudu/touch.txt") assert not exists(url) touch(url) assert exists(url) remove(urlsplit("test/tugudu")) assert not exists(urlsplit("test/tugudu")) assert not exists(url)
def test_touch_overwrite_existing_file(): url = urlsplit("test/toto/touch.txt") assert not exists(url) touch(url) assert exists(url) touch(url) assert exists(url) remove(url) assert not exists(url)
def test_exists_do_not_care_about_trailing_slashes(): for pth in ("test", "test/"): url = urlsplit(pth) assert exists(url)
def test_exists_return_true_for_existing_directory(): for pth in ("test", "test/toto", "test/toto/sub"): url = urlsplit(pth) assert exists(url)
def test_exists_return_true_for_existing_file(): for pth in ("setup.py", "test/toto/doofus.txt", "test/toto/sub/doofus.txt"): url = urlsplit(pth) assert exists(url)
def test_exists_do_not_raise_error_if_file_does_not_exists(): url = urlsplit("takapouet") assert not exists(url)