1
1
# MIT License
2
2
#
3
- # Copyright (c) 2018-2022 Tskit Developers
3
+ # Copyright (c) 2018-2023 Tskit Developers
4
4
# Copyright (C) 2017 University of Oxford
5
5
#
6
6
# Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1615,10 +1615,12 @@ def test_draw_multiroot(self):
1615
1615
1616
1616
def test_draw_mutations_over_roots (self ):
1617
1617
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 )
1622
1624
1623
1625
def test_draw_unary (self ):
1624
1626
t = self .get_unary_node_tree ()
@@ -2742,20 +2744,23 @@ def test_known_svg_ts_mutation_times_logscale(self, overwrite_viz, draw_plotbox)
2742
2744
svg , "ts_mut_times_logscale.svg" , overwrite_viz , width = 200 * ts .num_trees
2743
2745
)
2744
2746
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 ):
2746
2748
# An example with some muts on axis but not on a visible node
2747
2749
ts = msprime .simulate (10 , random_seed = 2 , mutation_rate = 1 )
2748
2750
tables = ts .dump_tables ()
2749
2751
tables .edges .clear ()
2750
2752
tables .mutations .time = np .full_like (tables .mutations .time , tskit .UNKNOWN_TIME )
2751
2753
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
+ )
2757
2762
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 ):
2759
2764
# An example with some muts on axis but not on a visible node
2760
2765
ts = msprime .simulate (10 , random_seed = 2 , mutation_rate = 1 )
2761
2766
tables = ts .dump_tables ()
@@ -2764,14 +2769,15 @@ def test_known_svg_ts_timed_mut_no_edges(self, overwrite_viz, draw_plotbox, capl
2764
2769
ts .num_mutations , dtype = tables .mutations .time .dtype
2765
2770
)
2766
2771
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
+ )
2775
2781
2776
2782
def test_known_svg_ts_multiroot (self , overwrite_viz , draw_plotbox , caplog ):
2777
2783
tables = wf .wf_sim (
0 commit comments