11# MIT License
22#
3- # Copyright (c) 2018-2022 Tskit Developers
3+ # Copyright (c) 2018-2023 Tskit Developers
44# Copyright (C) 2017 University of Oxford
55#
66# Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1615,10 +1615,12 @@ def test_draw_multiroot(self):
16151615
16161616 def test_draw_mutations_over_roots (self ):
16171617 t = self .get_mutations_over_roots_tree ()
1618- svg = t .draw ()
1619- self .verify_basic_svg (svg )
1620- svg = t .draw_svg ()
1621- self .verify_basic_svg (svg )
1618+ with pytest .warns (UserWarning , match = "nodes which are not present" ):
1619+ svg = t .draw ()
1620+ self .verify_basic_svg (svg )
1621+ with pytest .warns (UserWarning , match = "nodes which are not present" ):
1622+ svg = t .draw_svg ()
1623+ self .verify_basic_svg (svg )
16221624
16231625 def test_draw_unary (self ):
16241626 t = self .get_unary_node_tree ()
@@ -2742,20 +2744,23 @@ def test_known_svg_ts_mutation_times_logscale(self, overwrite_viz, draw_plotbox)
27422744 svg , "ts_mut_times_logscale.svg" , overwrite_viz , width = 200 * ts .num_trees
27432745 )
27442746
2745- def test_known_svg_ts_mut_no_edges (self , overwrite_viz , draw_plotbox , caplog ):
2747+ def test_known_svg_ts_mut_no_edges (self , overwrite_viz , draw_plotbox ):
27462748 # An example with some muts on axis but not on a visible node
27472749 ts = msprime .simulate (10 , random_seed = 2 , mutation_rate = 1 )
27482750 tables = ts .dump_tables ()
27492751 tables .edges .clear ()
27502752 tables .mutations .time = np .full_like (tables .mutations .time , tskit .UNKNOWN_TIME )
27512753 ts_no_edges = tables .tree_sequence ()
2752- svg = ts_no_edges .draw_svg (debug_box = draw_plotbox )
2753- assert "not present in the displayed tree" in caplog .text
2754- self .verify_known_svg (
2755- svg , "ts_mutations_no_edges.svg" , overwrite_viz , width = 200 * ts .num_trees
2756- )
2754+ with pytest .warns (UserWarning , match = "nodes which are not present" ):
2755+ svg = ts_no_edges .draw_svg (debug_box = draw_plotbox )
2756+ self .verify_known_svg (
2757+ svg ,
2758+ "ts_mutations_no_edges.svg" ,
2759+ overwrite_viz ,
2760+ width = 200 * ts .num_trees ,
2761+ )
27572762
2758- def test_known_svg_ts_timed_mut_no_edges (self , overwrite_viz , draw_plotbox , caplog ):
2763+ def test_known_svg_ts_timed_mut_no_edges (self , overwrite_viz , draw_plotbox ):
27592764 # An example with some muts on axis but not on a visible node
27602765 ts = msprime .simulate (10 , random_seed = 2 , mutation_rate = 1 )
27612766 tables = ts .dump_tables ()
@@ -2764,14 +2769,15 @@ def test_known_svg_ts_timed_mut_no_edges(self, overwrite_viz, draw_plotbox, capl
27642769 ts .num_mutations , dtype = tables .mutations .time .dtype
27652770 )
27662771 ts_no_edges = tables .tree_sequence ()
2767- svg = ts_no_edges .draw_svg (debug_box = draw_plotbox )
2768- assert "not present in the displayed tree" in caplog .text
2769- self .verify_known_svg (
2770- svg ,
2771- "ts_mutations_timed_no_edges.svg" ,
2772- overwrite_viz ,
2773- width = 200 * ts .num_trees ,
2774- )
2772+
2773+ with pytest .warns (UserWarning , match = "nodes which are not present" ):
2774+ svg = ts_no_edges .draw_svg (debug_box = draw_plotbox )
2775+ self .verify_known_svg (
2776+ svg ,
2777+ "ts_mutations_timed_no_edges.svg" ,
2778+ overwrite_viz ,
2779+ width = 200 * ts .num_trees ,
2780+ )
27752781
27762782 def test_known_svg_ts_multiroot (self , overwrite_viz , draw_plotbox , caplog ):
27772783 tables = wf .wf_sim (
0 commit comments