@@ -116,7 +116,7 @@ def test_vcf_dexplode_init_compressor(self, mocked, tmp_path, compressor):
116
116
runner = ct .CliRunner (mix_stderr = False )
117
117
result = runner .invoke (
118
118
cli .vcf2zarr_main ,
119
- f"dexplode-init { self .vcf_path } { icf_path } 1 -C { compressor } " ,
119
+ f"dexplode-init { self .vcf_path } { icf_path } -n 1 -C { compressor } " ,
120
120
catch_exceptions = False ,
121
121
)
122
122
assert result .exit_code == 0
@@ -294,7 +294,7 @@ def test_vcf_dexplode_init(self, mocked, tmp_path, progress, flag):
294
294
icf_path = tmp_path / "icf"
295
295
result = runner .invoke (
296
296
cli .vcf2zarr_main ,
297
- f"dexplode-init { self .vcf_path } { icf_path } 5 { flag } " ,
297
+ f"dexplode-init { self .vcf_path } { icf_path } -n 5 { flag } " ,
298
298
catch_exceptions = False ,
299
299
)
300
300
assert result .exit_code == 0
@@ -309,7 +309,7 @@ def test_vcf_dexplode_init(self, mocked, tmp_path, progress, flag):
309
309
** args ,
310
310
)
311
311
312
- @pytest .mark .parametrize ("num_partitions" , ["-- - 1" , "0" , "asdf" , "1.112" ])
312
+ @pytest .mark .parametrize ("num_partitions" , ["-1" , "0" , "asdf" , "1.112" ])
313
313
@mock .patch ("bio2zarr.vcf2zarr.explode_init" , return_value = 5 )
314
314
def test_vcf_dexplode_init_bad_num_partitions (
315
315
self , mocked , tmp_path , num_partitions
@@ -318,11 +318,24 @@ def test_vcf_dexplode_init_bad_num_partitions(
318
318
icf_path = tmp_path / "icf"
319
319
result = runner .invoke (
320
320
cli .vcf2zarr_main ,
321
- f"dexplode-init { self .vcf_path } { icf_path } { num_partitions } " ,
321
+ f"dexplode-init { self .vcf_path } { icf_path } -n { num_partitions } " ,
322
322
catch_exceptions = False ,
323
323
)
324
324
assert result .exit_code == 2
325
- assert "Invalid value for 'NUM_PARTITIONS'" in result .stderr
325
+ assert "Invalid value for '-n'" in result .stderr
326
+ mocked .assert_not_called ()
327
+
328
+ @mock .patch ("bio2zarr.vcf2zarr.explode_init" , return_value = 5 )
329
+ def test_vcf_dexplode_init_no_partitions (self , mocked , tmp_path ):
330
+ runner = ct .CliRunner (mix_stderr = False )
331
+ icf_path = tmp_path / "icf"
332
+ result = runner .invoke (
333
+ cli .vcf2zarr_main ,
334
+ f"dexplode-init { self .vcf_path } { icf_path } " ,
335
+ catch_exceptions = False ,
336
+ )
337
+ assert result .exit_code == 2
338
+ assert "-n/--num-partitions must currently be specified" in result .stderr
326
339
mocked .assert_not_called ()
327
340
328
341
@mock .patch ("bio2zarr.vcf2zarr.explode_partition" )
@@ -457,7 +470,7 @@ def test_dencode_init(self, mocked, tmp_path, progress, flag):
457
470
runner = ct .CliRunner (mix_stderr = False )
458
471
result = runner .invoke (
459
472
cli .vcf2zarr_main ,
460
- f"dencode-init { icf_path } { zarr_path } 10 { flag } " ,
473
+ f"dencode-init { icf_path } { zarr_path } -n 10 { flag } " ,
461
474
catch_exceptions = False ,
462
475
)
463
476
assert result .exit_code == 0
@@ -472,6 +485,21 @@ def test_dencode_init(self, mocked, tmp_path, progress, flag):
472
485
** args ,
473
486
)
474
487
488
+ @mock .patch ("bio2zarr.vcf2zarr.encode_init" , return_value = 5 )
489
+ def test_vcf_dencode_init_no_partitions (self , mocked , tmp_path ):
490
+ runner = ct .CliRunner (mix_stderr = False )
491
+ icf_path = tmp_path / "icf"
492
+ icf_path .mkdir ()
493
+ zarr_path = tmp_path / "zarr"
494
+ result = runner .invoke (
495
+ cli .vcf2zarr_main ,
496
+ f"dencode-init { icf_path } { zarr_path } " ,
497
+ catch_exceptions = False ,
498
+ )
499
+ assert result .exit_code == 2
500
+ assert "-n/--num-partitions must currently be specified" in result .stderr
501
+ mocked .assert_not_called ()
502
+
475
503
@mock .patch ("bio2zarr.vcf2zarr.encode_partition" )
476
504
def test_vcf_dencode_partition (self , mocked , tmp_path ):
477
505
runner = ct .CliRunner (mix_stderr = False )
@@ -601,7 +629,7 @@ def test_dexplode(self, tmp_path, one_based):
601
629
runner = ct .CliRunner (mix_stderr = False )
602
630
result = runner .invoke (
603
631
cli .vcf2zarr_main ,
604
- f"dexplode-init { self .vcf_path } { icf_path } 5 --json -Q" ,
632
+ f"dexplode-init { self .vcf_path } { icf_path } -n 5 --json -Q" ,
605
633
catch_exceptions = False ,
606
634
)
607
635
assert result .exit_code == 0
@@ -678,7 +706,7 @@ def test_dencode(self, tmp_path, one_based):
678
706
assert result .exit_code == 0
679
707
result = runner .invoke (
680
708
cli .vcf2zarr_main ,
681
- f"dencode-init { icf_path } { zarr_path } 5 --variants-chunk-size=3 --json" ,
709
+ f"dencode-init { icf_path } { zarr_path } -n 5 --variants-chunk-size=3 --json" ,
682
710
catch_exceptions = False ,
683
711
)
684
712
assert result .exit_code == 0
0 commit comments