Exemplo n.º 1
0
def test_write_big(ftp_writable, cache_type):
    host, port, user, pw = ftp_writable
    fs = FTPFileSystem(host, port, user, pw, block_size=1000,
                       cache_type=cache_type)
    fn = '/bigger'
    with fs.open(fn, 'wb') as f:
        f.write(b'o' * 500)
        assert not fs.exists(fn)
        f.write(b'o' * 1000)
        fs.invalidate_cache()
        assert fs.exists(fn)
        f.write(b'o' * 200)
        f.flush()
        assert f.buffer.tell() == 0

    assert fs.info(fn)['size'] == 1700
    assert fs.cat(fn) == b'o' * 1700
Exemplo n.º 2
0
def test_write_big(ftp_writable, cache_type):
    host, port, user, pw = ftp_writable
    fs = FTPFileSystem(host,
                       port,
                       user,
                       pw,
                       block_size=1000,
                       cache_type=cache_type)
    fn = "/bigger"
    with fs.open(fn, "wb") as f:
        f.write(b"o" * 500)
        assert not fs.exists(fn)
        f.write(b"o" * 1000)
        fs.invalidate_cache()
        assert fs.exists(fn)
        f.write(b"o" * 200)
        f.flush()

    assert fs.info(fn)["size"] == 1700
    assert fs.cat(fn) == b"o" * 1700