Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Orange/widgets/data/owselectrows.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,11 @@ def commit(self):
matching_output = remover(matching_output)
non_matching_output = remover(non_matching_output)

if matching_output is not None and not len(matching_output):
matching_output = None
if non_matching_output is not None and not len(non_matching_output):
non_matching_output = None

self.Outputs.matching_data.send(matching_output)
self.Outputs.unmatched_data.send(non_matching_output)

Expand Down
17 changes: 17 additions & 0 deletions Orange/widgets/data/tests/test_owselectrows.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,20 @@ def widget_with_context(self, domain, conditions):
settings = dict(context_settings=[context])

return self.create_widget(OWSelectRows, settings)

def test_output_filter(self):
"""
None on output when there is no data.
GH-2726
"""
data = Table("iris")[:10]
len_data = len(data)
self.send_signal(self.widget.Inputs.data, data)

self.enterFilter(data.domain[0], "is below", "-1")
self.assertIsNone(self.get_output("Matching Data"))
self.assertEqual(len(self.get_output("Unmatched Data")), len_data)
self.widget.remove_all_button.click()
self.enterFilter(data.domain[0], "is below", "10")
self.assertIsNone(self.get_output("Unmatched Data"))
self.assertEqual(len(self.get_output("Matching Data")), len_data)