Skip to content

Commit ef8fccc

Browse files
authored
Merge pull request #2726 from jerneju/rank-value-max
[FIX] Select Rows: None on output when no data
2 parents 45d8402 + 10eeb95 commit ef8fccc

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

Orange/widgets/data/owselectrows.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,11 @@ def commit(self):
530530
matching_output = remover(matching_output)
531531
non_matching_output = remover(non_matching_output)
532532

533+
if matching_output is not None and not len(matching_output):
534+
matching_output = None
535+
if non_matching_output is not None and not len(non_matching_output):
536+
non_matching_output = None
537+
533538
self.Outputs.matching_data.send(matching_output)
534539
self.Outputs.unmatched_data.send(non_matching_output)
535540

Orange/widgets/data/tests/test_owselectrows.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,3 +242,20 @@ def widget_with_context(self, domain, conditions):
242242
settings = dict(context_settings=[context])
243243

244244
return self.create_widget(OWSelectRows, settings)
245+
246+
def test_output_filter(self):
247+
"""
248+
None on output when there is no data.
249+
GH-2726
250+
"""
251+
data = Table("iris")[:10]
252+
len_data = len(data)
253+
self.send_signal(self.widget.Inputs.data, data)
254+
255+
self.enterFilter(data.domain[0], "is below", "-1")
256+
self.assertIsNone(self.get_output("Matching Data"))
257+
self.assertEqual(len(self.get_output("Unmatched Data")), len_data)
258+
self.widget.remove_all_button.click()
259+
self.enterFilter(data.domain[0], "is below", "10")
260+
self.assertIsNone(self.get_output("Unmatched Data"))
261+
self.assertEqual(len(self.get_output("Matching Data")), len_data)

0 commit comments

Comments
 (0)