Skip to content

Commit c49c8ac

Browse files
committed
Data Sampler: Test send_report
1 parent d05f395 commit c49c8ac

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

Orange/widgets/data/owdatasampler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,9 @@ def send_report(self):
336336
elif self.sampling_type == self.CrossValidation:
337337
tpe = f"{self.number_of_folds}-fold cross-validation " \
338338
f"without subset #{self.selectedFold}"
339-
else:
339+
elif self.sampling_type == self.Bootstrap:
340+
tpe = "Bootstrap"
341+
else: # pragma: no cover
340342
tpe = "Undefined" # should not come here at all
341343
if self.stratify:
342344
tpe += ", stratified (if possible)"

Orange/widgets/data/tests/test_owdatasampler.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,39 @@ def test_cv_output_migration(self):
192192
self.assertEqual(len(self.get_output(w.Outputs.data_sample)), 15)
193193
self.assertEqual(len(self.get_output(w.Outputs.remaining_data)), 135)
194194

195+
def test_send_report(self):
196+
w = self.widget
197+
self.send_signal(w.Inputs.data, self.iris)
198+
199+
w.stratify = True
200+
w.use_seed = True
201+
202+
self.select_sampling_type(0)
203+
w.commit()
204+
w.send_report()
205+
206+
self.select_sampling_type(1)
207+
w.sampleSizeNumber = 1
208+
w.commit()
209+
w.send_report()
210+
211+
w.sampleSizeNumber = 10
212+
w.replacement = False
213+
w.commit()
214+
w.send_report()
215+
216+
w.replacement = True
217+
w.commit()
218+
w.send_report()
219+
220+
self.select_sampling_type(2)
221+
w.commit()
222+
w.send_report()
223+
224+
self.select_sampling_type(3)
225+
w.commit()
226+
w.send_report()
227+
195228

196229
if __name__ == "__main__":
197230
unittest.main()

0 commit comments

Comments
 (0)