Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
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")
Exemplo n.º 4
0
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)
Exemplo n.º 5
0
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)
Exemplo n.º 6
0
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)
Exemplo n.º 7
0
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)
Exemplo n.º 8
0
def test_exists_do_not_care_about_trailing_slashes():
    for pth in ("test", "test/"):
        url = urlsplit(pth)
        assert exists(url)
Exemplo n.º 9
0
def test_exists_return_true_for_existing_directory():
    for pth in ("test", "test/toto", "test/toto/sub"):
        url = urlsplit(pth)
        assert exists(url)
Exemplo n.º 10
0
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)
Exemplo n.º 11
0
def test_exists_do_not_raise_error_if_file_does_not_exists():
    url = urlsplit("takapouet")
    assert not exists(url)