Traktor/myenv/Lib/site-packages/fsspec/implementations/tests/test_data.py

21 lines
541 B
Python
Raw Normal View History

2024-05-26 05:12:46 +02:00
import fsspec
def test_1():
with fsspec.open("data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==") as f:
assert f.read() == b"Hello, World!"
with fsspec.open("data:,Hello%2C%20World%21") as f:
assert f.read() == b"Hello, World!"
def test_info():
fs = fsspec.filesystem("data")
info = fs.info("data:text/html,%3Ch1%3EHello%2C%20World%21%3C%2Fh1%3E")
assert info == {
"name": "%3Ch1%3EHello%2C%20World%21%3C%2Fh1%3E",
"size": 22,
"type": "file",
"mimetype": "text/html",
}