Buckets:

download
raw
1.07 kB
import numpy as np
import pytest
from tiled.adapters.array import ArrayAdapter
from tiled.adapters.mapping import MapAdapter
from tiled.client import Context, from_context
from tiled.client.smoke import read
from tiled.server.app import build_app
class Broken(Exception):
pass
class BrokenArrayAdapter(ArrayAdapter):
def read(self, *args, **kwargs):
raise Broken
def read_block(self, *args, **kwargs):
raise Broken
@pytest.fixture(scope="module")
def context():
mapping = {
"A": ArrayAdapter.from_array(np.array([1, 2, 3]), metadata={"A": "a"}),
"B": BrokenArrayAdapter.from_array(np.array([4, 5, 6]), metadata={"B": "b"}),
}
tree = MapAdapter(mapping)
with Context.from_app(build_app(tree)) as context:
yield context
def test_smoke_read_list(context):
client = from_context(context)
faulty_list = read(client)
assert len(faulty_list) == 1
def test_smoke_read_raise(context):
client = from_context(context)
with pytest.raises(Broken):
read(client, strict=True)

Xet Storage Details

Size:
1.07 kB
·
Xet hash:
50acb966828c5d272c9f64bb00674d97d70c3a483fdcfd8476bb121c48fb1c5d

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.