示例#1
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)
示例#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)
示例#3
0
def test_write_raises_error_if_dir_pth_do_not_exists():
    url = urlsplit("test/tugudu/touch.txt")
    assert_raises(URLError, lambda: write(url, "toto was here"))