|
1 | 1 | """ |
2 | | -Smoke test: every public name is importable. |
| 2 | +Smoke test: the package imports and its top-level public surface is reachable. |
3 | 3 | """ |
4 | 4 |
|
5 | 5 | from __future__ import annotations |
6 | 6 |
|
7 | 7 |
|
8 | | -def test_top_level_imports() -> None: |
9 | | - from zarr_metadata import ( |
10 | | - JSON, |
11 | | - ArrayMetadata, |
12 | | - ArrayMetadataV2, |
13 | | - ArrayMetadataV3, |
14 | | - GroupMetadata, |
15 | | - GroupMetadataV2, |
16 | | - GroupMetadataV3, |
17 | | - NamedConfig, |
18 | | - NamedRequiredConfig, |
19 | | - ) |
| 8 | +def test_package_imports() -> None: |
| 9 | + """The package and its top-level union types load without errors.""" |
| 10 | + import zarr_metadata |
20 | 11 |
|
21 | | - _ = ( |
22 | | - JSON, |
23 | | - ArrayMetadata, |
24 | | - ArrayMetadataV2, |
25 | | - ArrayMetadataV3, |
26 | | - GroupMetadata, |
27 | | - GroupMetadataV2, |
28 | | - GroupMetadataV3, |
29 | | - NamedConfig, |
30 | | - NamedRequiredConfig, |
31 | | - ) |
32 | | - |
33 | | - |
34 | | -def test_v2_imports() -> None: |
35 | | - from zarr_metadata.v2 import ( |
36 | | - ArrayMetadataV2, |
37 | | - ConsolidatedMetadataV2, |
38 | | - DataTypeV2, |
39 | | - DataTypeV2Structured, |
40 | | - GroupMetadataV2, |
41 | | - ) |
42 | | - |
43 | | - _ = ( |
44 | | - ArrayMetadataV2, |
45 | | - ConsolidatedMetadataV2, |
46 | | - DataTypeV2, |
47 | | - DataTypeV2Structured, |
48 | | - GroupMetadataV2, |
49 | | - ) |
50 | | - |
51 | | - |
52 | | -def test_v3_imports() -> None: |
53 | | - from zarr_metadata.v3 import ( |
54 | | - AllowedExtraField, |
55 | | - ArrayMetadataV3, |
56 | | - ConsolidatedMetadataV3, |
57 | | - GroupMetadataV3, |
58 | | - MetadataField, |
59 | | - ) |
60 | | - |
61 | | - _ = ( |
62 | | - AllowedExtraField, |
63 | | - ArrayMetadataV3, |
64 | | - ConsolidatedMetadataV3, |
65 | | - GroupMetadataV3, |
66 | | - MetadataField, |
67 | | - ) |
68 | | - |
69 | | - |
70 | | -def test_v3_chunk_grid_imports() -> None: |
71 | | - from zarr_metadata.v3.chunk_grid.rectilinear import ( |
72 | | - RECTILINEAR_CHUNK_GRID_NAME, |
73 | | - RectilinearChunkGrid, |
74 | | - RectilinearChunkGridConfiguration, |
75 | | - RectilinearChunkGridName, |
76 | | - RectilinearDimSpec, |
77 | | - ) |
78 | | - from zarr_metadata.v3.chunk_grid.regular import ( |
79 | | - REGULAR_CHUNK_GRID_NAME, |
80 | | - RegularChunkGrid, |
81 | | - RegularChunkGridConfiguration, |
82 | | - RegularChunkGridName, |
83 | | - ) |
84 | | - |
85 | | - _ = ( |
86 | | - RECTILINEAR_CHUNK_GRID_NAME, |
87 | | - REGULAR_CHUNK_GRID_NAME, |
88 | | - RectilinearChunkGrid, |
89 | | - RectilinearChunkGridConfiguration, |
90 | | - RectilinearChunkGridName, |
91 | | - RectilinearDimSpec, |
92 | | - RegularChunkGrid, |
93 | | - RegularChunkGridConfiguration, |
94 | | - RegularChunkGridName, |
95 | | - ) |
96 | | - |
97 | | - |
98 | | -def test_v3_chunk_key_encoding_imports() -> None: |
99 | | - from zarr_metadata.v3.chunk_key_encoding import ChunkKeySeparator |
100 | | - from zarr_metadata.v3.chunk_key_encoding.default import ( |
101 | | - DEFAULT_CHUNK_KEY_ENCODING_NAME, |
102 | | - DefaultChunkKeyEncoding, |
103 | | - DefaultChunkKeyEncodingConfiguration, |
104 | | - DefaultChunkKeyEncodingName, |
105 | | - ) |
106 | | - from zarr_metadata.v3.chunk_key_encoding.v2 import ( |
107 | | - V2_CHUNK_KEY_ENCODING_NAME, |
108 | | - V2ChunkKeyEncoding, |
109 | | - V2ChunkKeyEncodingConfiguration, |
110 | | - V2ChunkKeyEncodingName, |
111 | | - ) |
112 | | - |
113 | | - _ = ( |
114 | | - ChunkKeySeparator, |
115 | | - DEFAULT_CHUNK_KEY_ENCODING_NAME, |
116 | | - DefaultChunkKeyEncoding, |
117 | | - DefaultChunkKeyEncodingConfiguration, |
118 | | - DefaultChunkKeyEncodingName, |
119 | | - V2_CHUNK_KEY_ENCODING_NAME, |
120 | | - V2ChunkKeyEncoding, |
121 | | - V2ChunkKeyEncodingConfiguration, |
122 | | - V2ChunkKeyEncodingName, |
123 | | - ) |
124 | | - |
125 | | - |
126 | | -def test_codec_imports() -> None: |
127 | | - from zarr_metadata.v3.codec import Codec |
128 | | - from zarr_metadata.v3.codec.blosc import ( |
129 | | - BloscCName, |
130 | | - BloscCodec, |
131 | | - BloscCodecConfiguration, |
132 | | - BloscCodecName, |
133 | | - BloscShuffle, |
134 | | - ) |
135 | | - from zarr_metadata.v3.codec.bytes import ( |
136 | | - BytesCodec, |
137 | | - BytesCodecConfiguration, |
138 | | - BytesCodecName, |
139 | | - ) |
140 | | - from zarr_metadata.v3.codec.crc32c import Crc32cCodec, Crc32cCodecName |
141 | | - from zarr_metadata.v3.codec.gzip import GzipCodec, GzipCodecConfiguration, GzipCodecName |
142 | | - from zarr_metadata.v3.codec.sharding import ( |
143 | | - ShardingCodec, |
144 | | - ShardingCodecConfiguration, |
145 | | - ShardingCodecName, |
146 | | - ) |
147 | | - from zarr_metadata.v3.codec.transpose import ( |
148 | | - TransposeCodec, |
149 | | - TransposeCodecConfiguration, |
150 | | - TransposeCodecName, |
151 | | - ) |
152 | | - from zarr_metadata.v3.codec.zstd import ZstdCodec, ZstdCodecConfiguration, ZstdCodecName |
153 | | - |
154 | | - _ = ( |
155 | | - Codec, |
156 | | - BloscCodec, |
157 | | - BloscCodecConfiguration, |
158 | | - BloscCodecName, |
159 | | - BytesCodec, |
160 | | - BytesCodecConfiguration, |
161 | | - BytesCodecName, |
162 | | - BloscCName, |
163 | | - Crc32cCodec, |
164 | | - Crc32cCodecName, |
165 | | - GzipCodec, |
166 | | - GzipCodecConfiguration, |
167 | | - GzipCodecName, |
168 | | - ShardingCodec, |
169 | | - ShardingCodecConfiguration, |
170 | | - ShardingCodecName, |
171 | | - BloscShuffle, |
172 | | - TransposeCodec, |
173 | | - TransposeCodecConfiguration, |
174 | | - TransposeCodecName, |
175 | | - ZstdCodec, |
176 | | - ZstdCodecConfiguration, |
177 | | - ZstdCodecName, |
178 | | - ) |
179 | | - |
180 | | - |
181 | | -def test_dtype_imports() -> None: |
182 | | - from zarr_metadata.v3.data_type import DType |
183 | | - from zarr_metadata.v3.data_type.bool import BOOL_DTYPE_NAME, BoolDTypeName, BoolFillValue |
184 | | - from zarr_metadata.v3.data_type.bytes import BYTES_DTYPE_NAME, BytesDTypeName, BytesFillValue |
185 | | - from zarr_metadata.v3.data_type.complex64 import ( |
186 | | - COMPLEX64_DTYPE_NAME, |
187 | | - Complex64Component, |
188 | | - Complex64DTypeName, |
189 | | - Complex64FillValue, |
190 | | - ) |
191 | | - from zarr_metadata.v3.data_type.complex128 import ( |
192 | | - COMPLEX128_DTYPE_NAME, |
193 | | - Complex128Component, |
194 | | - Complex128DTypeName, |
195 | | - Complex128FillValue, |
196 | | - ) |
197 | | - from zarr_metadata.v3.data_type.float16 import ( |
198 | | - FLOAT16_DTYPE_NAME, |
199 | | - Float16DTypeName, |
200 | | - Float16FillValue, |
201 | | - Float16SpecialFillValue, |
202 | | - ) |
203 | | - from zarr_metadata.v3.data_type.float32 import ( |
204 | | - FLOAT32_DTYPE_NAME, |
205 | | - Float32DTypeName, |
206 | | - Float32FillValue, |
207 | | - Float32SpecialFillValue, |
208 | | - ) |
209 | | - from zarr_metadata.v3.data_type.float64 import ( |
210 | | - FLOAT64_DTYPE_NAME, |
211 | | - Float64DTypeName, |
212 | | - Float64FillValue, |
213 | | - Float64SpecialFillValue, |
214 | | - ) |
215 | | - from zarr_metadata.v3.data_type.int8 import INT8_DTYPE_NAME, Int8DTypeName, Int8FillValue |
216 | | - from zarr_metadata.v3.data_type.int16 import INT16_DTYPE_NAME, Int16DTypeName, Int16FillValue |
217 | | - from zarr_metadata.v3.data_type.int32 import INT32_DTYPE_NAME, Int32DTypeName, Int32FillValue |
218 | | - from zarr_metadata.v3.data_type.int64 import INT64_DTYPE_NAME, Int64DTypeName, Int64FillValue |
219 | | - from zarr_metadata.v3.data_type.numpy_datetime64 import ( |
220 | | - NUMPY_DATETIME64_DTYPE_NAME, |
221 | | - NumpyDatetime64, |
222 | | - NumpyDatetime64Configuration, |
223 | | - NumpyDatetime64DTypeName, |
224 | | - NumpyDatetime64FillValue, |
225 | | - ) |
226 | | - from zarr_metadata.v3.data_type.numpy_timedelta64 import ( |
227 | | - NUMPY_TIMEDELTA64_DTYPE_NAME, |
228 | | - NumpyTimedelta64, |
229 | | - NumpyTimedelta64Configuration, |
230 | | - NumpyTimedelta64DTypeName, |
231 | | - NumpyTimedelta64FillValue, |
232 | | - ) |
233 | | - from zarr_metadata.v3.data_type.string import ( |
234 | | - STRING_DTYPE_NAME, |
235 | | - StringDTypeName, |
236 | | - StringFillValue, |
237 | | - ) |
238 | | - from zarr_metadata.v3.data_type.struct import ( |
239 | | - STRUCT_DTYPE_NAME, |
240 | | - Struct, |
241 | | - StructConfiguration, |
242 | | - StructDTypeName, |
243 | | - StructField, |
244 | | - StructFillValue, |
245 | | - ) |
246 | | - from zarr_metadata.v3.data_type.uint8 import UINT8_DTYPE_NAME, Uint8DTypeName, Uint8FillValue |
247 | | - from zarr_metadata.v3.data_type.uint16 import ( |
248 | | - UINT16_DTYPE_NAME, |
249 | | - Uint16DTypeName, |
250 | | - Uint16FillValue, |
251 | | - ) |
252 | | - from zarr_metadata.v3.data_type.uint32 import ( |
253 | | - UINT32_DTYPE_NAME, |
254 | | - Uint32DTypeName, |
255 | | - Uint32FillValue, |
256 | | - ) |
257 | | - from zarr_metadata.v3.data_type.uint64 import ( |
258 | | - UINT64_DTYPE_NAME, |
259 | | - Uint64DTypeName, |
260 | | - Uint64FillValue, |
261 | | - ) |
262 | | - |
263 | | - _ = ( |
264 | | - DType, |
265 | | - BOOL_DTYPE_NAME, |
266 | | - BYTES_DTYPE_NAME, |
267 | | - BoolDTypeName, |
268 | | - BoolFillValue, |
269 | | - BytesDTypeName, |
270 | | - BytesFillValue, |
271 | | - COMPLEX64_DTYPE_NAME, |
272 | | - COMPLEX128_DTYPE_NAME, |
273 | | - Complex64Component, |
274 | | - Complex64DTypeName, |
275 | | - Complex64FillValue, |
276 | | - Complex128Component, |
277 | | - Complex128DTypeName, |
278 | | - Complex128FillValue, |
279 | | - FLOAT16_DTYPE_NAME, |
280 | | - FLOAT32_DTYPE_NAME, |
281 | | - FLOAT64_DTYPE_NAME, |
282 | | - Float16DTypeName, |
283 | | - Float16FillValue, |
284 | | - Float16SpecialFillValue, |
285 | | - Float32DTypeName, |
286 | | - Float32FillValue, |
287 | | - Float32SpecialFillValue, |
288 | | - Float64DTypeName, |
289 | | - Float64FillValue, |
290 | | - Float64SpecialFillValue, |
291 | | - INT8_DTYPE_NAME, |
292 | | - INT16_DTYPE_NAME, |
293 | | - INT32_DTYPE_NAME, |
294 | | - INT64_DTYPE_NAME, |
295 | | - Int8DTypeName, |
296 | | - Int8FillValue, |
297 | | - Int16DTypeName, |
298 | | - Int16FillValue, |
299 | | - Int32DTypeName, |
300 | | - Int32FillValue, |
301 | | - Int64DTypeName, |
302 | | - Int64FillValue, |
303 | | - NUMPY_DATETIME64_DTYPE_NAME, |
304 | | - NUMPY_TIMEDELTA64_DTYPE_NAME, |
305 | | - NumpyDatetime64, |
306 | | - NumpyDatetime64Configuration, |
307 | | - NumpyDatetime64DTypeName, |
308 | | - NumpyDatetime64FillValue, |
309 | | - NumpyTimedelta64, |
310 | | - NumpyTimedelta64Configuration, |
311 | | - NumpyTimedelta64DTypeName, |
312 | | - NumpyTimedelta64FillValue, |
313 | | - STRING_DTYPE_NAME, |
314 | | - STRUCT_DTYPE_NAME, |
315 | | - StringDTypeName, |
316 | | - StringFillValue, |
317 | | - Struct, |
318 | | - StructConfiguration, |
319 | | - StructDTypeName, |
320 | | - StructField, |
321 | | - StructFillValue, |
322 | | - UINT8_DTYPE_NAME, |
323 | | - UINT16_DTYPE_NAME, |
324 | | - UINT32_DTYPE_NAME, |
325 | | - UINT64_DTYPE_NAME, |
326 | | - Uint8DTypeName, |
327 | | - Uint8FillValue, |
328 | | - Uint16DTypeName, |
329 | | - Uint16FillValue, |
330 | | - Uint32DTypeName, |
331 | | - Uint32FillValue, |
332 | | - Uint64DTypeName, |
333 | | - Uint64FillValue, |
334 | | - ) |
| 12 | + # Touch the cross-version unions to confirm both v2 and v3 submodules |
| 13 | + # load and the top-level __init__ wires the union types correctly. |
| 14 | + assert zarr_metadata.ArrayMetadata is not None |
| 15 | + assert zarr_metadata.GroupMetadata is not None |
0 commit comments