Example #1
0
def test_hashfs_put_file(fs, filepath):
    address = fs.put(str(filepath))

    assert_file_put(fs, address)

    with open(address.abspath, "rb") as fileobj:
        assert fileobj.read() == to_bytes(filepath.read())
Example #2
0
def test_hashfs_put_stringio(fs, stringio):
    address = fs.put(stringio)

    assert_file_put(fs, address)

    with open(address.abspath, "rb") as fileobj:
        assert fileobj.read() == to_bytes(stringio.getvalue())
Example #3
0
def test_hashfs_put_file(fs, filepath):
    address = fs.put(str(filepath))

    assert_file_put(fs, address)

    with open(address.abspath, 'rb') as fileobj:
        assert fileobj.read() == to_bytes(filepath.read())
Example #4
0
def test_hashfs_put_stringio(fs, stringio):
    address = fs.put(stringio)

    assert_file_put(fs, address)

    with open(address.abspath, 'rb') as fileobj:
        assert fileobj.read() == to_bytes(stringio.getvalue())
Example #5
0
def test_hashfs_open(fs, stringio, extension, address_attr):
    address = fs.put(stringio, extension)

    fileobj = fs.open(getattr(address, address_attr))

    assert isinstance(fileobj, BufferedReader)
    assert fileobj.read() == to_bytes(stringio.getvalue())

    fileobj.close()
Example #6
0
def test_hashfs_open(fs, stringio, extension, address_attr):
    address = fs.put(stringio, extension)

    fileobj = fs.open(getattr(address, address_attr))

    assert isinstance(fileobj, BufferedReader)
    assert fileobj.read() == to_bytes(stringio.getvalue())

    fileobj.close()