@@ -18,6 +18,7 @@ def test_recursive_cleanfigure():
18
18
ax .set_ylim ([20 , 80 ])
19
19
ax .set_xlim ([20 , 80 ])
20
20
cleanfigure ._recursive_cleanfigure (fig )
21
+ plt .close ("all" )
21
22
22
23
23
24
def test_pruneOutsideBox ():
@@ -35,8 +36,6 @@ def test_pruneOutsideBox():
35
36
ylim([20, 80])
36
37
cleanfigure;
37
38
```
38
-
39
-
40
39
"""
41
40
x = np .linspace (1 , 100 , 20 )
42
41
y = np .linspace (1 , 100 , 20 )
@@ -48,6 +47,7 @@ def test_pruneOutsideBox():
48
47
ax .set_xlim ([20 , 80 ])
49
48
cleanfigure ._pruneOutsideBox (fig , ax , l )
50
49
assert l .get_xdata ().shape == (14 ,)
50
+ plt .close ("all" )
51
51
52
52
53
53
def test_replaceDataWithNaN ():
@@ -65,8 +65,6 @@ def test_replaceDataWithNaN():
65
65
ylim([20, 80])
66
66
cleanfigure;
67
67
```
68
-
69
-
70
68
"""
71
69
id_replace = np .array ([0 , 16 ])
72
70
xData = np .linspace (1 , 100 , 20 )
@@ -82,6 +80,7 @@ def test_replaceDataWithNaN():
82
80
newdata = np .stack (l .get_data (), axis = 1 )
83
81
assert newdata .shape == data .shape
84
82
assert np .any (np .isnan (newdata ))
83
+ plt .close ("all" )
85
84
86
85
87
86
def test_removeData ():
@@ -99,8 +98,6 @@ def test_removeData():
99
98
ylim([20, 80])
100
99
cleanfigure;
101
100
```
102
-
103
-
104
101
"""
105
102
id_remove = np .array ([1 , 2 , 3 , 17 , 18 , 19 ])
106
103
xData = np .linspace (1 , 100 , 20 )
@@ -113,6 +110,7 @@ def test_removeData():
113
110
cleanfigure ._removeData (l , id_remove )
114
111
newdata = np .stack (l .get_data (), axis = 1 )
115
112
assert newdata .shape == (14 , 2 )
113
+ plt .close ("all" )
116
114
117
115
118
116
def test_removeNaNs ():
@@ -144,6 +142,7 @@ def test_removeNaNs():
144
142
newdata = np .stack (l .get_data (), axis = 1 )
145
143
assert not np .any (np .isnan (newdata ))
146
144
assert newdata .shape == (12 , 2 )
145
+ plt .close ("all" )
147
146
148
147
149
148
def test_isInBox ():
@@ -198,6 +197,7 @@ def test_getVisualLimits():
198
197
xLim , yLim = cleanfigure ._getVisualLimits (fig , ax )
199
198
assert np .allclose (xLim , np .array ([20 , 80 ]))
200
199
assert np .allclose (yLim , np .array ([20 , 80 ]))
200
+ plt .close ("all" )
201
201
202
202
203
203
def test_movePointsCloser ():
@@ -230,6 +230,7 @@ def test_movePointsCloser():
230
230
cleanfigure ._pruneOutsideBox (fig , ax , l )
231
231
cleanfigure ._movePointscloser (fig , ax , l )
232
232
assert l .get_xdata ().shape == (14 ,)
233
+ plt .close ("all" )
233
234
234
235
235
236
def test_simplifyLine ():
@@ -264,6 +265,7 @@ def test_simplifyLine():
264
265
cleanfigure ._simplifyLine (fig , ax , l , 600 )
265
266
assert l .get_xdata ().shape == (2 ,)
266
267
assert l .get_ydata ().shape == (2 ,)
268
+ plt .close ("all" )
267
269
268
270
269
271
# def test_simplifyStairs():
@@ -334,6 +336,7 @@ def test_limitPrecision():
334
336
cleanfigure ._limitPrecision (fig , ax , l , 1 )
335
337
assert l .get_xdata ().shape == (2 ,)
336
338
assert l .get_ydata ().shape == (2 ,)
339
+ plt .close ("all" )
337
340
338
341
339
342
def test_opheimSimplify ():
@@ -400,6 +403,7 @@ def test_is_step(function, result):
400
403
elif function == "step" :
401
404
(l ,) = ax .step (x , y )
402
405
assert cleanfigure ._isStep (l ) == result
406
+ plt .close ("all" )
403
407
404
408
405
409
class Test_plottypes :
@@ -428,6 +432,7 @@ def test_plot(self):
428
432
numLinesRaw = raw .count ("\n " )
429
433
numLinesClean = clean .count ("\n " )
430
434
assert numLinesRaw - numLinesClean == 18
435
+ plt .close ("all" )
431
436
432
437
def test_step (self ):
433
438
""" """
@@ -442,6 +447,7 @@ def test_step(self):
442
447
ax .set_xlim ([20 , 80 ])
443
448
with pytest .warns (Warning ):
444
449
cleanfigure .cleanfigure (fig )
450
+ plt .close ("all" )
445
451
446
452
def test_scatter (self ):
447
453
""" """
@@ -456,6 +462,7 @@ def test_scatter(self):
456
462
ax .set_xlim ([20 , 80 ])
457
463
with pytest .warns (Warning ):
458
464
cleanfigure .cleanfigure (fig )
465
+ plt .close ("all" )
459
466
460
467
def test_bar (self ):
461
468
""" """
@@ -469,6 +476,7 @@ def test_bar(self):
469
476
ax .set_xlim ([20 , 80 ])
470
477
with pytest .warns (Warning ):
471
478
cleanfigure .cleanfigure (fig )
479
+ plt .close ("all" )
472
480
473
481
def test_hist (self ):
474
482
"""creates same test case as bar"""
@@ -482,6 +490,7 @@ def test_hist(self):
482
490
ax .set_xlim ([20 , 80 ])
483
491
with pytest .warns (Warning ):
484
492
cleanfigure .cleanfigure (fig )
493
+ plt .close ("all" )
485
494
486
495
def test_plot3d (self ):
487
496
""" """
@@ -509,6 +518,7 @@ def test_plot3d(self):
509
518
numLinesRaw = raw .count ("\n " )
510
519
numLinesClean = clean .count ("\n " )
511
520
assert numLinesRaw - numLinesClean == 14
521
+ plt .close ("all" )
512
522
513
523
def test_scatter3d (self ):
514
524
""" """
@@ -525,6 +535,7 @@ def test_scatter3d(self):
525
535
ax .set_zlim ([0 , 80 ])
526
536
with pytest .warns (Warning ):
527
537
cleanfigure .cleanfigure (fig )
538
+ plt .close ("all" )
528
539
529
540
def test_wireframe3D (self ):
530
541
""" """
@@ -541,6 +552,7 @@ def test_wireframe3D(self):
541
552
ax .plot_wireframe (X , Y , Z , rstride = 10 , cstride = 10 )
542
553
with pytest .warns (Warning ):
543
554
cleanfigure .cleanfigure (fig )
555
+ plt .close ("all" )
544
556
545
557
def test_surface3D (self ):
546
558
""" """
@@ -573,6 +585,7 @@ def test_surface3D(self):
573
585
574
586
with pytest .warns (Warning ):
575
587
cleanfigure .cleanfigure (fig )
588
+ plt .close ("all" )
576
589
577
590
def test_trisurface3D (self ):
578
591
"""
@@ -608,6 +621,7 @@ def test_trisurface3D(self):
608
621
ax .plot_trisurf (x , y , z , linewidth = 0.2 , antialiased = True )
609
622
with pytest .warns (Warning ):
610
623
cleanfigure .cleanfigure (fig )
624
+ plt .close ("all" )
611
625
612
626
def test_contour3D (self ):
613
627
""" """
@@ -623,6 +637,7 @@ def test_contour3D(self):
623
637
ax .clabel (cset , fontsize = 9 , inline = 1 )
624
638
with pytest .warns (Warning ):
625
639
cleanfigure .cleanfigure (fig )
640
+ plt .close ("all" )
626
641
627
642
def test_polygon3D (self ):
628
643
""" """
@@ -663,6 +678,7 @@ def cc(arg):
663
678
ax .set_zlim3d (0 , 1 )
664
679
with pytest .warns (Warning ):
665
680
cleanfigure .cleanfigure (fig )
681
+ plt .close ("all" )
666
682
667
683
def test_bar3D (self ):
668
684
""" """
@@ -687,6 +703,7 @@ def test_bar3D(self):
687
703
ax .set_zlabel ("Z" )
688
704
with pytest .warns (Warning ):
689
705
cleanfigure .cleanfigure (fig )
706
+ plt .close ("all" )
690
707
691
708
def test_quiver3D (self ):
692
709
""" """
@@ -717,6 +734,7 @@ def test_quiver3D(self):
717
734
ax .quiver (x , y , z , u , v , w , length = 0.1 , normalize = True )
718
735
with pytest .warns (Warning ):
719
736
cleanfigure .cleanfigure (fig )
737
+ plt .close ("all" )
720
738
721
739
def test_2D_in_3D (self ):
722
740
""" """
@@ -757,6 +775,7 @@ def test_2D_in_3D(self):
757
775
ax .view_init (elev = 20.0 , azim = - 35 )
758
776
with pytest .warns (Warning ):
759
777
cleanfigure .cleanfigure (fig )
778
+ plt .close ("all" )
760
779
761
780
762
781
class Test_lineplot :
@@ -789,6 +808,7 @@ def test_line_no_markers(self):
789
808
numLinesRaw = raw .count ("\n " )
790
809
numLinesClean = clean .count ("\n " )
791
810
assert numLinesRaw - numLinesClean == 18
811
+ plt .close ("all" )
792
812
793
813
def test_no_line_markers (self ):
794
814
"""test high-level usage for simple example.
@@ -817,6 +837,7 @@ def test_no_line_markers(self):
817
837
numLinesRaw = raw .count ("\n " )
818
838
numLinesClean = clean .count ("\n " )
819
839
assert numLinesRaw - numLinesClean == 6
840
+ plt .close ("all" )
820
841
821
842
def test_line_markers (self ):
822
843
"""test high-level usage for simple example.
@@ -845,6 +866,7 @@ def test_line_markers(self):
845
866
numLinesRaw = raw .count ("\n " )
846
867
numLinesClean = clean .count ("\n " )
847
868
assert numLinesRaw - numLinesClean == 6
869
+ plt .close ("all" )
848
870
849
871
def test_sine (self ):
850
872
""" """
@@ -869,6 +891,7 @@ def test_sine(self):
869
891
numLinesRaw = raw .count ("\n " )
870
892
numLinesClean = clean .count ("\n " )
871
893
assert numLinesRaw - numLinesClean == 39
894
+ plt .close ("all" )
872
895
873
896
874
897
class Test_subplots :
@@ -924,6 +947,7 @@ def test_subplot(self):
924
947
numLinesRaw = raw .count ("\n " )
925
948
numLinesClean = clean .count ("\n " )
926
949
assert numLinesRaw - numLinesClean == 36
950
+ plt .close ("all" )
927
951
928
952
929
953
def test_segmentVisible ():
0 commit comments