Example #1
0
def test_open_raise_not_found():
    with pytest.raises(FileNotFoundError):
        with copen("s3://elyza-datasets/not_existing.txt", "r") as f:
            text = f.read()
Example #2
0
def test_open_read_s3_00():
    with copen("s3://elyza-sandbox/cloudio/README.md") as f:
        text = f.read()
    assert text[:9] == "# cloudio"
Example #3
0
def test_open_write_s3_binary():
    with copen("s3://elyza-sandbox/cloudio/boo.bin", "wb") as f:
        f.write(b"bar")
Example #4
0
def test_open_write_s3():
    with copen("s3://elyza-sandbox/cloudio/bar.txt", "w") as f:
        f.write("bar")
Example #5
0
def test_open_read_fileobj():
    url = "s3://elyza-sandbox/cloudio/fuga.csv"
    with copen(url) as f:
        df = pd.read_csv(f)
    assert df["a"][0] == 1
Example #6
0
def test_open_read_binary():
    with copen("pyproject.toml", "rb") as f:
        text = f.read()
    assert isinstance(text, bytes)
    assert text.decode()[:13] == "[tool.poetry]"
Example #7
0
def test_open_read_local():
    with copen("pyproject.toml") as f:
        text = f.read()
    assert text[:13] == "[tool.poetry]"