Skip to content

Commit 988f9df

Browse files
committed
fixed tests
1 parent cd40b08 commit 988f9df

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

src/zarr/core/metadata/v3.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -530,14 +530,17 @@ def parse(cls, dtype: None | DataType | Any) -> DataType:
530530
return DataType.float64
531531
if isinstance(dtype, DataType):
532532
return dtype
533-
else:
534-
try:
535-
dtype = np.dtype(dtype)
536-
except (ValueError, TypeError) as e:
537-
raise ValueError(f"Invalid V3 data_type: {dtype}") from e
538-
# check that this is a valid v3 data_type
539-
try:
540-
data_type = DataType.from_numpy_dtype(dtype)
541-
except KeyError as e:
542-
raise ValueError(f"Invalid V3 data_type: {dtype}") from e
543-
return data_type
533+
try:
534+
return DataType(dtype)
535+
except ValueError:
536+
pass
537+
try:
538+
dtype = np.dtype(dtype)
539+
except (ValueError, TypeError) as e:
540+
raise ValueError(f"Invalid V3 data_type: {dtype}") from e
541+
# check that this is a valid v3 data_type
542+
try:
543+
data_type = DataType.from_numpy_dtype(dtype)
544+
except KeyError as e:
545+
raise ValueError(f"Invalid V3 data_type: {dtype}") from e
546+
return data_type

tests/v3/test_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def test_config_defaults_set() -> None:
5858
"crc32c": "zarr.codecs.crc32c_.Crc32cCodec",
5959
"sharding_indexed": "zarr.codecs.sharding.ShardingCodec",
6060
"transpose": "zarr.codecs.transpose.TransposeCodec",
61+
"vlen-utf8": "zarr.codecs.legacy_vlen.VLenUTF8Codec",
6162
},
6263
}
6364
]

0 commit comments

Comments
 (0)