Skip to content

Commit f8cfb65

Browse files
committed
remove if DISABLE_PLOT == False: from tests
1 parent 25fca17 commit f8cfb65

1 file changed

Lines changed: 37 additions & 30 deletions

File tree

test/test_output.py

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
"""output tests"""
22

3-
try:
3+
try:
4+
from .tools import DISABLE_PLOT, interface
45
from .tools import robust_path as get_shared_data
56
except ImportError:
7+
from tools import DISABLE_PLOT, interface
68
from tools import robust_path as get_shared_data
79

810
from openalea.stat_tool.convolution import Convolution
@@ -42,23 +44,20 @@ def test_plot_mixture_1(self):
4244

4345
def test_plot_mixture_2(self):
4446
m = self.get_mixture_2()
45-
if DISABLE_PLOT == False:
46-
m.plot()
47+
m.plot()
4748

4849
def test_plot_mixture_data(self):
4950
mixt1 = Mixture(
5051
0.6, Distribution("B", 2, 18, 0.5), 0.4, Distribution("NB", 10, 10, 0.5)
5152
)
5253
mixt_histo1 = Simulate(mixt1, 200)
53-
54-
if DISABLE_PLOT == False:
55-
mixt1.plot()
56-
mixt_histo1.plot()
54+
55+
mixt1.plot()
56+
mixt_histo1.plot()
5757

5858
def test_plot_convolution(self):
59-
convol1 = Convolution("data/convolution1.conv")
60-
if DISABLE_PLOT == False:
61-
Plot(convol1.extract_elementary(1), convol1.extract_elementary(2))
59+
convol1 = Convolution("data/convolution1.conv")
60+
Plot(convol1.extract_elementary(1), convol1.extract_elementary(2))
6261

6362
histo_b2 = Histogram("data/nothofagus_antarctica_bud_2.his")
6463
histo_s2 = Histogram("data/nothofagus_antarctica_shoot_2.his")
@@ -71,50 +70,41 @@ def test_plot_convolution(self):
7170
Estimator="PenalizedLikelihood",
7271
Weight=0.5,
7372
)
74-
if DISABLE_PLOT == False:
75-
Plot(convol31.extract_elementary(1))
73+
Plot(convol31.extract_elementary(1))
7674

7775
def test_plot_convolution_data(self):
7876
convol1 = Convolution("data/convolution1.conv")
79-
convol_histo1 = Simulate(convol1, 200)
80-
if DISABLE_PLOT == False:
81-
convol_histo1.plot()
77+
convol_histo1 = Simulate(convol1, 200)
78+
convol_histo1.plot()
8279

8380
def _test_plot_distribution_set(self):
8481
d1 = Distribution("B", 2, 18, 0.5)
8582
d2 = Distribution("NB", 10, 10, 0.5)
8683
d3 = Distribution("U", 10, 20)
87-
88-
if DISABLE_PLOT == False:
89-
Plot(d1, d2, d3)
90-
d1.old_plot()
84+
85+
Plot(d1, d2, d3)
86+
d1.old_plot()
9187

9288
def test_plot_survival(self):
9389
d1 = Distribution("B", 2, 18, 0.5)
94-
95-
if DISABLE_PLOT == False:
96-
d1.plot(ViewPoint="Survival")
90+
d1.plot(ViewPoint="Survival")
9791

9892
histo1 = Simulate(d1, 200)
99-
if DISABLE_PLOT == False:
100-
histo1.plot(ViewPoint="Survival")
93+
histo1.plot(ViewPoint="Survival")
10194

10295
def test_plot_parametric_model(self):
10396
dist1 = Distribution("NB", 0, 3.5, 0.3)
10497
histo1 = Simulate(dist1, 200)
105-
if DISABLE_PLOT == False:
106-
Plot(histo1)
107-
dist2 = Estimate(histo1, "NB", MinInfBound=0, InfBoundStatus="Fixed")
108-
if DISABLE_PLOT == False:
109-
Plot(dist2)
98+
Plot(histo1)
99+
dist2 = Estimate(histo1, "NB", MinInfBound=0, InfBoundStatus="Fixed")
100+
Plot(dist2)
110101

111102

112103
def test_output_plot_viewpoint_survival():
113104
d1 = Distribution("B", 2, 19, 0.5)
114105
Plot(d1)
115106
Plot(d1, ViewPoint="Survival")
116107

117-
118108
def test_output_display_detail():
119109
d1 = Distribution("B", 2, 19, 0.5)
120110
print(Display(d1))
@@ -148,3 +138,20 @@ def test_output_display_viewpoint_data():
148138
except:
149139
assert True
150140

141+
142+
if __name__ == "__main__":
143+
T = Test()
144+
T.test_plot_convolution()
145+
T.test_plot_convolution_data()
146+
T.test_plot_mixture_1()
147+
T.test_plot_mixture_2()
148+
T.test_plot_mixture_data()
149+
T.test_plot_parametric_model()
150+
T._test_plot_distribution_set()
151+
T._test_old_plot()
152+
T.test_plot_survival()
153+
test_output_display_detail()
154+
test_output_display_viewpoint_data()
155+
test_output_display_viewpoint_survival()
156+
test_output_plot_viewpoint_survival()
157+

0 commit comments

Comments
 (0)