示例#1
0
文件: test_base.py 项目: EricM2/venv
def test_api_open_binary_read(with_adapter: str, bucket: str) -> None:
    path = Pathy(f"gs://{bucket}/read_binary/file.txt")
    path.write_bytes(b"---")
    with path.open(mode="rb") as file_obj:
        assert file_obj.readlines() == [b"---"]
    with path.open(mode="rb") as file_obj:
        assert file_obj.readline() == b"---"
        assert file_obj.readline() == b""
示例#2
0
文件: test_base.py 项目: EricM2/venv
def test_api_readwrite_bytes(with_adapter: str, bucket: str) -> None:
    path = Pathy(f"gs://{bucket}/write_bytes/file.txt")
    path.write_bytes(b"---")
    assert path.read_bytes() == b"---"