7
7
import numcodecs
8
8
9
9
from bio2zarr import vcf
10
+ from bio2zarr import provenance
10
11
11
12
12
13
class TestSmallExample :
@@ -26,6 +27,14 @@ def icf(self, tmp_path_factory):
26
27
out = tmp_path_factory .mktemp ("data" ) / "example.exploded"
27
28
return vcf .explode ([self .data_path ], out )
28
29
30
+ def test_format_version (self , icf ):
31
+ assert icf .metadata .format_version == vcf .ICF_METADATA_FORMAT_VERSION
32
+
33
+ def test_provenance (self , icf ):
34
+ assert icf .metadata .provenance == {
35
+ "source" : f"bio2zarr-{ provenance .__version__ } "
36
+ }
37
+
29
38
def test_mkschema (self , tmp_path , icf ):
30
39
schema_file = tmp_path / "schema.json"
31
40
with open (schema_file , "w" ) as f :
@@ -252,7 +261,7 @@ def test_missing_field(self, tmp_path):
252
261
def test_missing_chunk_index (self , tmp_path ):
253
262
icf_path = tmp_path / "icf"
254
263
vcf .explode ([self .data_path ], icf_path )
255
- chunk_index_path = icf_path / "POS" / "p0" / "chunk_index"
264
+ chunk_index_path = icf_path / "POS" / "p0" / "chunk_index"
256
265
assert chunk_index_path .exists ()
257
266
chunk_index_path .unlink ()
258
267
icf = vcf .IntermediateColumnarFormat (icf_path )
@@ -262,7 +271,7 @@ def test_missing_chunk_index(self, tmp_path):
262
271
def test_missing_chunk_file (self , tmp_path ):
263
272
icf_path = tmp_path / "icf"
264
273
vcf .explode ([self .data_path ], icf_path )
265
- chunk_file = icf_path / "POS" / "p0" / "2"
274
+ chunk_file = icf_path / "POS" / "p0" / "2"
266
275
assert chunk_file .exists ()
267
276
chunk_file .unlink ()
268
277
icf = vcf .IntermediateColumnarFormat (icf_path )
@@ -272,7 +281,7 @@ def test_missing_chunk_file(self, tmp_path):
272
281
def test_empty_chunk_file (self , tmp_path ):
273
282
icf_path = tmp_path / "icf"
274
283
vcf .explode ([self .data_path ], icf_path )
275
- chunk_file = icf_path / "POS" / "p0" / "2"
284
+ chunk_file = icf_path / "POS" / "p0" / "2"
276
285
assert chunk_file .exists ()
277
286
with open (chunk_file , "w" ) as f :
278
287
pass
@@ -284,7 +293,7 @@ def test_empty_chunk_file(self, tmp_path):
284
293
def test_truncated_chunk_file (self , tmp_path , length ):
285
294
icf_path = tmp_path / "icf"
286
295
vcf .explode ([self .data_path ], icf_path )
287
- chunk_file = icf_path / "POS" / "p0" / "2"
296
+ chunk_file = icf_path / "POS" / "p0" / "2"
288
297
with open (chunk_file , "rb" ) as f :
289
298
buff = f .read (length )
290
299
assert len (buff ) == length
@@ -298,7 +307,7 @@ def test_truncated_chunk_file(self, tmp_path, length):
298
307
def test_chunk_incorrect_length (self , tmp_path ):
299
308
icf_path = tmp_path / "icf"
300
309
vcf .explode ([self .data_path ], icf_path )
301
- chunk_file = icf_path / "POS" / "p0" / "2"
310
+ chunk_file = icf_path / "POS" / "p0" / "2"
302
311
compressor = numcodecs .Blosc (cname = "lz4" )
303
312
with open (chunk_file , "rb" ) as f :
304
313
pkl = compressor .decode (f .read ())
@@ -321,7 +330,9 @@ class TestSlicing:
321
330
@pytest .fixture (scope = "class" )
322
331
def icf (self , tmp_path_factory ):
323
332
out = tmp_path_factory .mktemp ("data" ) / "example.exploded"
324
- return vcf .explode ([self .data_path ], out , column_chunk_size = 0.0125 , worker_processes = 0 )
333
+ return vcf .explode (
334
+ [self .data_path ], out , column_chunk_size = 0.0125 , worker_processes = 0
335
+ )
325
336
326
337
def test_repr (self , icf ):
327
338
assert repr (icf ).startswith (
0 commit comments