Skip to content

Commit e5ffc33

Browse files
committed
approach the coverage problems by reducing the denominator
1 parent ef31c5b commit e5ffc33

File tree

21 files changed

+53
-43
lines changed

21 files changed

+53
-43
lines changed

src/zarr/abc/codec.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def validate(
138138
"""
139139

140140
async def _decode_single(self, chunk_data: CodecOutput, chunk_spec: ArraySpec) -> CodecInput:
141-
raise NotImplementedError
141+
raise NotImplementedError # pragma: no cover
142142

143143
async def decode(
144144
self,
@@ -161,7 +161,7 @@ async def decode(
161161
async def _encode_single(
162162
self, chunk_data: CodecInput, chunk_spec: ArraySpec
163163
) -> CodecOutput | None:
164-
raise NotImplementedError
164+
raise NotImplementedError # pragma: no cover
165165

166166
async def encode(
167167
self,
@@ -203,7 +203,7 @@ class ArrayBytesCodecPartialDecodeMixin:
203203
async def _decode_partial_single(
204204
self, byte_getter: ByteGetter, selection: SelectorTuple, chunk_spec: ArraySpec
205205
) -> NDBuffer | None:
206-
raise NotImplementedError
206+
raise NotImplementedError # pragma: no cover
207207

208208
async def decode_partial(
209209
self,
@@ -242,7 +242,7 @@ async def _encode_partial_single(
242242
selection: SelectorTuple,
243243
chunk_spec: ArraySpec,
244244
) -> None:
245-
raise NotImplementedError
245+
raise NotImplementedError # pragma: no cover
246246

247247
async def encode_partial(
248248
self,
@@ -321,7 +321,7 @@ def from_array_metadata_and_store(cls, array_metadata: ArrayMetadata, store: Sto
321321
-------
322322
Self
323323
"""
324-
raise NotImplementedError(
324+
raise NotImplementedError( # pragma: no cover
325325
f"'{type(cls).__name__}' does not implement CodecPipeline.from_array_metadata_and_store."
326326
)
327327

src/zarr/abc/store.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def with_read_only(self, read_only: bool = False) -> Store:
100100
-------
101101
A new store of the same type with the new read only attribute.
102102
"""
103-
raise NotImplementedError(
103+
raise NotImplementedError( # pragma: no cover
104104
f"with_read_only is not implemented for the {type(self)} store type."
105105
)
106106

@@ -150,7 +150,7 @@ async def is_empty(self, prefix: str) -> bool:
150150
True if the store is empty, False otherwise.
151151
"""
152152
if not self.supports_listing:
153-
raise NotImplementedError
153+
raise NotImplementedError # pragma: no cover
154154
if prefix != "" and not prefix.endswith("/"):
155155
prefix += "/"
156156
async for _ in self.list_prefix(prefix):
@@ -164,9 +164,9 @@ async def clear(self) -> None:
164164
Remove all keys and values from the store.
165165
"""
166166
if not self.supports_deletes:
167-
raise NotImplementedError
167+
raise NotImplementedError # pragma: no cover
168168
if not self.supports_listing:
169-
raise NotImplementedError
169+
raise NotImplementedError # pragma: no cover
170170
self._check_writable()
171171
await self.delete_dir("")
172172

@@ -393,9 +393,9 @@ async def delete_dir(self, prefix: str) -> None:
393393
Remove all keys and prefixes in the store that begin with a given prefix.
394394
"""
395395
if not self.supports_deletes:
396-
raise NotImplementedError
396+
raise NotImplementedError # pragma: no cover
397397
if not self.supports_listing:
398-
raise NotImplementedError
398+
raise NotImplementedError # pragma: no cover
399399
self._check_writable()
400400
if prefix != "" and not prefix.endswith("/"):
401401
prefix += "/"

src/zarr/api/asynchronous.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,15 @@ async def consolidate_metadata(
244244

245245

246246
async def copy(*args: Any, **kwargs: Any) -> tuple[int, int, int]:
247-
raise NotImplementedError
247+
raise NotImplementedError # pragma: no cover
248248

249249

250250
async def copy_all(*args: Any, **kwargs: Any) -> tuple[int, int, int]:
251-
raise NotImplementedError
251+
raise NotImplementedError # pragma: no cover
252252

253253

254254
async def copy_store(*args: Any, **kwargs: Any) -> tuple[int, int, int]:
255-
raise NotImplementedError
255+
raise NotImplementedError # pragma: no cover
256256

257257

258258
async def load(

src/zarr/codecs/_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,4 @@ async def _encode_single(
152152
return chunk_spec.prototype.buffer.from_bytes(cdata)
153153

154154
def compute_encoded_size(self, _input_byte_length: int, _chunk_spec: ArraySpec) -> int:
155-
raise NotImplementedError
155+
raise NotImplementedError # pragma: no cover

src/zarr/codecs/blosc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ async def _encode_single(
198198
)
199199

200200
def compute_encoded_size(self, _input_byte_length: int, _chunk_spec: ArraySpec) -> int:
201-
raise NotImplementedError
201+
raise NotImplementedError # pragma: no cover
202202

203203

204204
register_codec("blosc", BloscCodec)

src/zarr/codecs/gzip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def compute_encoded_size(
7272
_input_byte_length: int,
7373
_chunk_spec: ArraySpec,
7474
) -> int:
75-
raise NotImplementedError
75+
raise NotImplementedError # pragma: no cover
7676

7777

7878
register_codec("gzip", GzipCodec)

src/zarr/codecs/sharding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def __setitem__(self, chunk_coords: ChunkCoords, value: Buffer) -> None:
264264
self.index.set_chunk_slice(chunk_coords, slice(chunk_start, chunk_start + chunk_length))
265265

266266
def __delitem__(self, chunk_coords: ChunkCoords) -> None:
267-
raise NotImplementedError
267+
raise NotImplementedError # pragma: no cover
268268

269269
async def finalize(
270270
self,

src/zarr/codecs/vlen_utf8.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ async def _encode_single(
6767

6868
def compute_encoded_size(self, input_byte_length: int, _chunk_spec: ArraySpec) -> int:
6969
# what is input_byte_length for an object dtype?
70-
raise NotImplementedError("compute_encoded_size is not implemented for VLen codecs")
70+
raise NotImplementedError(
71+
"compute_encoded_size is not implemented for VLen codecs"
72+
) # pragma: no cover
7173

7274

7375
@dataclass(frozen=True)
@@ -111,7 +113,9 @@ async def _encode_single(
111113

112114
def compute_encoded_size(self, input_byte_length: int, _chunk_spec: ArraySpec) -> int:
113115
# what is input_byte_length for an object dtype?
114-
raise NotImplementedError("compute_encoded_size is not implemented for VLen codecs")
116+
raise NotImplementedError(
117+
"compute_encoded_size is not implemented for VLen codecs"
118+
) # pragma: no cover
115119

116120

117121
register_codec("vlen-utf8", VLenUTF8Codec)

src/zarr/codecs/zstd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async def _encode_single(
9191
)
9292

9393
def compute_encoded_size(self, _input_byte_length: int, _chunk_spec: ArraySpec) -> int:
94-
raise NotImplementedError
94+
raise NotImplementedError # pragma: no cover
9595

9696

9797
register_codec("zstd", ZstdCodec)

src/zarr/core/buffer/core.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,9 @@ def from_bytes(cls, bytes_like: BytesLike) -> Self:
225225
New buffer representing `bytes_like`
226226
"""
227227
if cls is Buffer:
228-
raise NotImplementedError("Cannot call abstract method on the abstract class 'Buffer'")
228+
raise NotImplementedError(
229+
"Cannot call abstract method on the abstract class 'Buffer'"
230+
) # pragma: no cover
229231
return cls(
230232
cast("ArrayLike", None)
231233
) # This line will never be reached, but it satisfies the type checker
@@ -367,7 +369,7 @@ def create(
367369
other then the default Numpy array.
368370
"""
369371
if cls is NDBuffer:
370-
raise NotImplementedError(
372+
raise NotImplementedError( # pragma: no cover
371373
"Cannot call abstract method on the abstract class 'NDBuffer'"
372374
)
373375
return cls(
@@ -439,7 +441,7 @@ def from_numpy_array(cls, array_like: npt.ArrayLike) -> Self:
439441
New buffer representing `array_like`
440442
"""
441443
if cls is NDBuffer:
442-
raise NotImplementedError(
444+
raise NotImplementedError( # pragma: no cover
443445
"Cannot call abstract method on the abstract class 'NDBuffer'"
444446
)
445447
return cls(

0 commit comments

Comments
 (0)