From 4a39c97306f732c2026de3dde1b98a8a793b4c56 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Thu, 22 Oct 2020 12:09:16 -0700 Subject: [PATCH] Doctest seem to be stricter now, updating tostring() to tobytes() --- docs/tutorial.rst | 8 +++++--- zarr/storage.py | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/tutorial.rst b/docs/tutorial.rst index ebc5db7165..0327cb248a 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -797,12 +797,14 @@ Here is an example using S3Map to read an array created previously:: Compressor : Blosc(cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=0) Store type : fsspec.mapping.FSMap No. bytes : 21 + No. bytes stored : 382 + Storage ratio : 0.1 Chunks initialized : 3/3 >>> z[:] array([b'H', b'e', b'l', b'l', b'o', b' ', b'f', b'r', b'o', b'm', b' ', b't', b'h', b'e', b' ', b'c', b'l', b'o', b'u', b'd', b'!'], dtype='|S1') - >>> z[:].tostring() + >>> z[:].tobytes() b'Hello from the cloud!' Zarr now also has a builtin storage backend for Azure Blob Storage. @@ -841,11 +843,11 @@ store. E.g.:: >>> z = root['foo/bar/baz'] >>> from timeit import timeit >>> # first data access is relatively slow, retrieved from store - ... timeit('print(z[:].tostring())', number=1, globals=globals()) # doctest: +SKIP + ... timeit('print(z[:].tobytes())', number=1, globals=globals()) # doctest: +SKIP b'Hello from the cloud!' 0.1081731989979744 >>> # second data access is faster, uses cache - ... timeit('print(z[:].tostring())', number=1, globals=globals()) # doctest: +SKIP + ... timeit('print(z[:].tobytes())', number=1, globals=globals()) # doctest: +SKIP b'Hello from the cloud!' 0.0009490990014455747 diff --git a/zarr/storage.py b/zarr/storage.py index 89f85f8eec..90dbc7dae6 100644 --- a/zarr/storage.py +++ b/zarr/storage.py @@ -1972,11 +1972,11 @@ class LRUStoreCache(MutableMapping): >>> z = root['foo/bar/baz'] # doctest: +REMOTE_DATA >>> from timeit import timeit >>> # first data access is relatively slow, retrieved from store - ... timeit('print(z[:].tostring())', number=1, globals=globals()) # doctest: +SKIP + ... timeit('print(z[:].tobytes())', number=1, globals=globals()) # doctest: +SKIP b'Hello from the cloud!' 0.1081731989979744 >>> # second data access is faster, uses cache - ... timeit('print(z[:].tostring())', number=1, globals=globals()) # doctest: +SKIP + ... timeit('print(z[:].tobytes())', number=1, globals=globals()) # doctest: +SKIP b'Hello from the cloud!' 0.0009490990014455747