@@ -357,21 +357,18 @@ def test_individuals_no_nodes_default_args(self):
357357 with warnings .catch_warnings (record = True ) as w :
358358 with pytest .raises (ValueError , match = "No samples in resulting VCF model" ):
359359 ts2 .as_vcf (allow_position_zero = True )
360- assert len (w ) == 2
360+ assert len (w ) == 1
361361 assert "At least one sample node does not have an individual ID" in str (
362362 w [0 ].message
363363 )
364- assert "Individual 0 has no nodes associated with it." in str (w [1 ].message )
365364
366365 def test_individuals_no_nodes_as_argument (self ):
367366 ts1 = msprime .simulate (10 , mutation_rate = 0.1 , random_seed = 2 )
368367 tables = ts1 .dump_tables ()
369368 tables .individuals .add_row ()
370369 ts2 = tables .tree_sequence ()
371370 with warnings .catch_warnings (record = True ) as w :
372- with pytest .raises (
373- ValueError , match = "Individual 0 has no nodes associated with it."
374- ):
371+ with pytest .raises (ValueError , match = "No samples in resulting VCF model" ):
375372 ts2 .as_vcf (individuals = [0 ])
376373 assert len (w ) == 1
377374 assert "At least one sample node does not have an individual ID" in str (
@@ -395,7 +392,7 @@ def test_ploidy_with_no_node_individuals(self):
395392 def test_empty_individuals (self ):
396393 ts = msprime .sim_ancestry (3 , random_seed = 2 )
397394 ts = tsutil .insert_branch_sites (ts )
398- with pytest .raises (ValueError , match = "No samples in resulting VCF model " ):
395+ with pytest .raises (ValueError , match = "No individuals specified " ):
399396 ts .as_vcf (individuals = [])
400397
401398 def test_duplicate_individuals (self ):
@@ -404,28 +401,6 @@ def test_duplicate_individuals(self):
404401 with pytest .raises (tskit .LibraryError , match = "TSK_ERR_DUPLICATE_SAMPLE" ):
405402 ts .as_vcf (individuals = [0 , 0 ], allow_position_zero = True )
406403
407- def test_mixed_sample_non_sample_individuals (self ):
408- ts = msprime .sim_ancestry (3 , random_seed = 2 )
409- tables = ts .dump_tables ()
410- tables .individuals .add_row ()
411- # Add a reference to an individual from a non-sample
412- individual = tables .nodes .individual
413- individual [- 1 ] = 0
414- tables .nodes .individual = individual
415- ts = tables .tree_sequence ()
416- ts = tsutil .insert_branch_sites (ts )
417- with warnings .catch_warnings (record = True ) as w :
418- ts .map_to_vcf_model ()
419- assert len (w ) == 2
420- assert (
421- "Individual 0 has both sample and non-sample nodes associated with it."
422- in str (w [0 ].message )
423- )
424- assert "Individual 3 has no nodes associated with it." in str (w [1 ].message )
425- with warnings .catch_warnings (record = True ) as w :
426- assert len (ts .as_vcf (individuals = [1 , 2 ], allow_position_zero = True )) > 0
427- assert len (w ) == 0
428-
429404 def test_samples_with_and_without_individuals (self ):
430405 ts = tskit .Tree .generate_balanced (3 ).tree_sequence
431406 tables = ts .dump_tables ()
0 commit comments