MCPcopy
hub / github.com/dask/dask / test_ops_blocksize

Function test_ops_blocksize

dask/bytes/tests/test_http.py:111–134  ·  view source on GitHub ↗
(dir_server)

Source from the content-addressed store, hash-verified

109
110
111def test_ops_blocksize(dir_server):
112 root = "http://localhost:8999/"
113 fn = files[0]
114 f = open_files(root + fn, block_size=2)[0]
115 with open(os.path.join(dir_server, fn), "rb") as expected:
116 expected = expected.read()
117 with f as f:
118 # it's OK to read the whole file
119 assert f.read() == expected
120 # and now the file magically has a size
121 assert f.size == len(expected)
122
123 # note that if we reuse f from above, because it is tokenized, we get
124 # the same open file - where is this cached?
125 fn = files[1]
126 f = open_files(root + fn, block_size=2)[0]
127 with f as f:
128 if Version(fsspec.__version__) < Version("2021.11.1"):
129 # fails because we want only 12 bytes
130 with pytest.raises(ValueError):
131 assert f.read(10) == expected[:10]
132 else:
133 # fixed in https://github.com/fsspec/filesystem_spec/pull/830
134 assert f.read(10) == expected[:10]
135
136
137def test_errors(dir_server):

Callers

nothing calls this directly

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…