Skip to content

Commit 2e58a7a

Browse files
authored
chore: remove warning on fixed length utf32 (zarr-developers#3979)
1 parent b740cf2 commit 2e58a7a

3 files changed

Lines changed: 4 additions & 18 deletions

File tree

changes/3979.misc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove the `UnstableSpecificationWarning` emitted when serializing a `FixedLengthUTF32` data type instance, as a spec for this data type has been published to zarr-extensions.

src/zarr/core/dtype/npy/string.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
HasLength,
2727
HasObjectCodec,
2828
check_dtype_spec_v2,
29-
v3_unstable_dtype_warning,
3029
)
3130
from zarr.core.dtype.npy.common import (
3231
check_json_str,
@@ -115,6 +114,9 @@ class FixedLengthUTF32(
115114
Wraps the ``np.dtypes.StrDType`` data type. Scalars for this data type are instances of
116115
``np.str_``.
117116
117+
The Zarr V3 specification for this data type is defined at
118+
https://github.com/zarr-developers/zarr-extensions/tree/main/data-types/fixed_length_utf32.
119+
118120
Attributes
119121
----------
120122
dtype_cls : Type[np.dtypes.StrDType]
@@ -247,7 +249,6 @@ def to_json(
247249
if zarr_format == 2:
248250
return {"name": self.to_native_dtype().str, "object_codec_id": None}
249251
elif zarr_format == 3:
250-
v3_unstable_dtype_warning(self)
251252
return {
252253
"name": self._zarr_v3_name,
253254
"configuration": {"length_bytes": self.length * self.code_point_bytes},

tests/test_dtype/test_npy/test_string.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from tests.test_dtype.test_wrapper import BaseTestZDType
77
from zarr.core.dtype import FixedLengthUTF32
88
from zarr.core.dtype.npy.string import _NUMPY_SUPPORTS_VLEN_STRING, VariableLengthUTF8
9-
from zarr.errors import UnstableSpecificationWarning
109

1110
if _NUMPY_SUPPORTS_VLEN_STRING:
1211

@@ -125,21 +124,6 @@ class TestFixedLengthUTF32(BaseTestZDType):
125124
invalid_scalar_params = (None,)
126125

127126

128-
@pytest.mark.parametrize(
129-
"zdtype",
130-
[
131-
FixedLengthUTF32(length=10),
132-
],
133-
)
134-
def test_unstable_dtype_warning(zdtype: FixedLengthUTF32 | VariableLengthUTF8) -> None:
135-
"""
136-
Test that we get a warning when serializing a dtype without a zarr v3 spec to json
137-
when zarr_format is 3
138-
"""
139-
with pytest.warns(UnstableSpecificationWarning):
140-
zdtype.to_json(zarr_format=3)
141-
142-
143127
def test_invalid_size() -> None:
144128
"""
145129
Test that it's impossible to create a data type that has no length

0 commit comments

Comments
 (0)