Skip to content

Commit 616fe5e

Browse files
committed
increased the number of comparison plot testss, and set to 2 the minimum of Mock models.
1 parent 9902d47 commit 616fe5e

File tree

1 file changed

+30
-27
lines changed

1 file changed

+30
-27
lines changed

tests/test_plots.py

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -80,33 +80,36 @@ def test_MultiSTestPlot(self, show=False):
8080

8181
def test_MultiTTestPlot(self, show=False):
8282

83-
t_plots = numpy.random.randint(1, 20)
84-
t_tests = []
85-
86-
def rand(limit=10, offset=0):
87-
return limit * (numpy.random.random() - offset)
88-
89-
for n in range(t_plots):
90-
t_result = mock.Mock() # Mock class with random attributes
91-
t_result.name = 'CSEP1 Comparison Test'
92-
t_result.sim_name = (''.join(random.choice(string.ascii_letters)
93-
for _ in range(8)), 'ref')
94-
t_result.observed_statistic = rand(offset=0.5)
95-
t_result.test_distribution = [
96-
t_result.observed_statistic - rand(5),
97-
t_result.observed_statistic + rand(5)]
98-
99-
if numpy.random.random() < 0.05: # sim possible infinite values
100-
t_result.observed_statistic = -numpy.inf
101-
t_tests.append(t_result)
102-
matplotlib.pyplot.close()
103-
plots.plot_comparison_test(t_tests)
104-
t_tests.reverse()
105-
self.assertEqual(
106-
[i.get_text() for i in matplotlib.pyplot.gca().get_xticklabels()],
107-
[i.sim_name[0] for i in t_tests[::-1]])
108-
self.assertEqual(matplotlib.pyplot.gca().get_title(),
109-
t_tests[0].name)
83+
for i in range(10):
84+
t_plots = numpy.random.randint(2, 20)
85+
t_tests = []
86+
87+
def rand(limit=10, offset=0):
88+
return limit * (numpy.random.random() - offset)
89+
90+
for n in range(t_plots):
91+
t_result = mock.Mock() # Mock class with random attributes
92+
t_result.name = 'CSEP1 Comparison Test'
93+
t_result.sim_name = (
94+
''.join(random.choice(string.ascii_letters)
95+
for _ in range(8)), 'ref')
96+
t_result.observed_statistic = rand(offset=0.5)
97+
t_result.test_distribution = [
98+
t_result.observed_statistic - rand(5),
99+
t_result.observed_statistic + rand(5)]
100+
101+
if numpy.random.random() < 0.05: # sim possible infinite values
102+
t_result.observed_statistic = -numpy.inf
103+
t_tests.append(t_result)
104+
matplotlib.pyplot.close()
105+
plots.plot_comparison_test(t_tests)
106+
t_tests.reverse()
107+
self.assertEqual(
108+
[i.get_text() for i in
109+
matplotlib.pyplot.gca().get_xticklabels()],
110+
[i.sim_name[0] for i in t_tests[::-1]])
111+
self.assertEqual(matplotlib.pyplot.gca().get_title(),
112+
t_tests[0].name)
110113

111114

112115
if __name__ == '__main__':

0 commit comments

Comments
 (0)