@@ -218,15 +218,6 @@ def test_chunk_size(self, schema):
218
218
assert schema .samples_chunk_size == 1000
219
219
assert schema .variants_chunk_size == 10000
220
220
221
- def test_dimensions (self , schema ):
222
- assert schema .dimensions == [
223
- "variants" ,
224
- "samples" ,
225
- "ploidy" ,
226
- "alleles" ,
227
- "filters" ,
228
- ]
229
-
230
221
def test_samples (self , schema ):
231
222
assert schema .asdict ()["samples" ] == [
232
223
{"id" : s } for s in ["NA00001" , "NA00002" , "NA00003" ]
@@ -569,3 +560,30 @@ def test_call_fields(self, tmp_path, field):
569
560
self .generate_vcf (vcf_file , format_field = field )
570
561
with pytest .raises (ValueError , match = f"FORMAT field name.*{ field } " ):
571
562
vcf .explode (tmp_path / "x.icf" , [tmp_path / "test.vcf.gz" ])
563
+
564
+
565
+ class TestBadSchemaChanges :
566
+ # [{'id': 'NA00001'}, {'id': 'NA00002'}, {'id': 'NA00003'}],
567
+ @pytest .mark .parametrize (
568
+ "samples" ,
569
+ [
570
+ [],
571
+ [{"id" : "NA00001" }, {"id" : "NA00003" }],
572
+ [{"id" : "NA00001" }, {"id" : "NA00002" }, {"id" : "NA00004" }],
573
+ [
574
+ {"id" : "NA00001" },
575
+ {"id" : "NA00002" },
576
+ {"id" : "NA00003" },
577
+ {"id" : "NA00004" },
578
+ ],
579
+ [{"id" : "NA00001" }, {"id" : "NA00003" }, {"id" : "NA00002" }],
580
+ ],
581
+ )
582
+ def test_removed_samples (self , tmp_path , schema , icf_path , samples ):
583
+ d = schema .asdict ()
584
+ d ["samples" ] = samples
585
+ schema_path = tmp_path / "schema.json"
586
+ with open (schema_path , "w" ) as f :
587
+ json .dump (d , f )
588
+ with pytest .raises (ValueError , match = "Subsetting or reordering samples" ):
589
+ vcf .encode (icf_path , tmp_path / "z" , schema_path = schema_path )
0 commit comments