Skip to content

Commit

Permalink
state_summary: Remove tests
Browse files Browse the repository at this point in the history
  • Loading branch information
janezd committed Mar 7, 2021
1 parent 479f0bc commit 3fbbfe9
Show file tree
Hide file tree
Showing 20 changed files with 0 additions and 428 deletions.
19 changes: 0 additions & 19 deletions Orange/widgets/data/tests/test_owcolor.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,25 +703,6 @@ def test_report(self):
def test_string_variables(self):
self.send_signal(self.widget.Inputs.data, Table("zoo"))

def test_summary(self):
"""Check if the status bar is updated when data is received"""
data = self.iris
input_sum = self.widget.info.set_input_summary = Mock()
output_sum = self.widget.info.set_output_summary = Mock()

self.send_signal(self.widget.Inputs.data, data)
input_sum.assert_called_with(len(data), format_summary_details(data))
output = self.get_output(self.widget.Outputs.data)
output_sum.assert_called_with(len(output),
format_summary_details(output))
input_sum.reset_mock()
output_sum.reset_mock()
self.send_signal(self.widget.Inputs.data, None)
input_sum.assert_called_once()
self.assertIsInstance(input_sum.call_args[0][0], StateInfo.Empty)
output_sum.assert_called_once()
self.assertIsInstance(output_sum.call_args[0][0], StateInfo.Empty)

def test_reset(self):
self.send_signal(self.widget.Inputs.data, self.iris)
cont_model = self.widget.cont_model
Expand Down
21 changes: 0 additions & 21 deletions Orange/widgets/data/tests/test_owcontinuize.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,6 @@ def test_empty_data(self):
imp_data = self.get_output(self.widget.Outputs.data)
self.assertIsNone(imp_data)

def test_summary(self):
"""Check if status bar is updated when data is received"""
data = Table("iris")
input_sum = self.widget.info.set_input_summary = Mock()
output_sum = self.widget.info.set_output_summary = Mock()

self.send_signal(self.widget.Inputs.data, data)
input_sum.assert_called_with(len(data),
format_summary_details(data))
output = self.get_output(self.widget.Outputs.data)
output_sum.assert_called_with(len(output),
format_summary_details(output))

input_sum.reset_mock()
output_sum.reset_mock()
self.send_signal(self.widget.Inputs.data, None)
input_sum.assert_called_once()
self.assertIsInstance(input_sum.call_args[0][0], StateInfo.Empty)
output_sum.assert_called_once()
self.assertIsInstance(output_sum.call_args[0][0], StateInfo.Empty)

def test_continuous(self):
table = Table("housing")
self.send_signal(self.widget.Inputs.data, table)
Expand Down
20 changes: 0 additions & 20 deletions Orange/widgets/data/tests/test_owcorrelations.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,26 +303,6 @@ def test_send_report(self):
self.send_signal(self.widget.Inputs.data, None)
self.widget.report_button.click()

def test_summary(self):
"""Check if status bar is updated when data is received"""
data = Table("iris")
input_sum = self.widget.info.set_input_summary = Mock()
output_sum = self.widget.info.set_output_summary = Mock()

self.send_signal(self.widget.Inputs.data, data)
input_sum.assert_called_with(len(data), format_summary_details(data))
output = self.get_output(self.widget.Outputs.data)
output_sum.assert_called_with(len(output),
format_summary_details(output))

input_sum.reset_mock()
output_sum.reset_mock()
self.send_signal(self.widget.Inputs.data, None)
input_sum.assert_called_once()
self.assertIsInstance(input_sum.call_args[0][0], StateInfo.Empty)
output_sum.assert_called_once()
self.assertIsInstance(output_sum.call_args[0][0], StateInfo.Empty)


class TestCorrelationRank(WidgetTest):
@classmethod
Expand Down
19 changes: 0 additions & 19 deletions Orange/widgets/data/tests/test_owcsvimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,25 +147,6 @@ def test_restore_from_local(self):
)
self._check_data_regions(self.get_output("Data", w))

def test_summary(self):
"""Check if status bar is updated when data is received"""
dirname = os.path.dirname(__file__)
path = os.path.join(dirname, "data-regions.tab")
widget = self.create_widget(
owcsvimport.OWCSVFileImport,
stored_settings={
"_session_items": [
(path, self.data_regions_options.as_dict())
]
}
)
output_sum = widget.info.set_output_summary = mock.Mock()
widget.commit()
self.wait_until_finished(widget)
output = self.get_output("Data", widget)
output_sum.assert_called_with(len(output),
format_summary_details(output))

data_csv_types_options = owcsvimport.Options(
encoding="ascii", dialect=csv.excel_tab(),
columntypes=[
Expand Down
20 changes: 0 additions & 20 deletions Orange/widgets/data/tests/test_owdatasampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,26 +122,6 @@ def test_shuffling(self):
self.assertTrue((self.iris.ids != sample.ids).any())
self.assertEqual(set(self.iris.ids), set(sample.ids))

def test_summary(self):
"""Check if status bar is updated when data is received"""
data = self.iris
input_sum = self.widget.info.set_input_summary = Mock()
output_sum = self.widget.info.set_output_summary = Mock()

self.send_signal(self.widget.Inputs.data, data)
input_sum.assert_called_with(len(data), format_summary_details(data))
output = self.get_output(self.widget.Outputs.data_sample)
output_sum.assert_called_with(len(output),
format_summary_details(output))

input_sum.reset_mock()
output_sum.reset_mock()
self.send_signal(self.widget.Inputs.data, None)
input_sum.assert_called_once()
self.assertIsInstance(input_sum.call_args[0][0], StateInfo.Empty)
output_sum.assert_called_once()
self.assertIsInstance(output_sum.call_args[0][0], StateInfo.Empty)

def set_fixed_sample_size(self, sample_size, with_replacement=False):
"""Set fixed sample size and return the number of gui spin.
Expand Down
18 changes: 0 additions & 18 deletions Orange/widgets/data/tests/test_owdatasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,6 @@ def test_dir_depth(self):
self.wait_until_stop_blocking(w)
self.assertEqual(w.view.model().rowCount(), 2)

@patch("Orange.widgets.data.owdatasets.list_remote",
Mock(return_value={('core', 'iris.tab'): {}}))
@patch("Orange.widgets.data.owdatasets.list_local",
Mock(return_value={}))
@patch("Orange.widgets.data.owdatasets.ensure_local",
Mock(return_value="iris.tab"))
def test_summary(self):
"""Check if status bar is updated when data is received"""
widget = self.create_widget(OWDataSets)
output_sum = widget.info.set_output_summary = Mock()
self.wait_until_stop_blocking(widget)
# select the only dataset
sel_type = QItemSelectionModel.ClearAndSelect | QItemSelectionModel.Rows
widget.view.selectionModel().select(widget.view.model().index(0, 0), sel_type)
widget.commit()
output = self.get_output(widget.Outputs.data, widget)
output_sum.assert_called_with(len(output),
format_summary_details(output))

if __name__ == "__main__":
unittest.main()
20 changes: 0 additions & 20 deletions Orange/widgets/data/tests/test_owdiscretize.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,6 @@ def test_empty_data(self):
widget.unconditional_commit()
self.assertIsNotNone(self.get_output(widget.Outputs.data))

def test_summary(self):
"""Check if status bar is updated when data is received"""
input_sum = self.widget.info.set_input_summary = Mock()
output_sum = self.widget.info.set_output_summary = Mock()

data = Table("iris")
self.send_signal(self.widget.Inputs.data, data)
input_sum.assert_called_with(len(data), format_summary_details(data))
output = self.get_output(self.widget.Outputs.data)
output_sum.assert_called_with(len(output),
format_summary_details(output))

input_sum.reset_mock()
output_sum.reset_mock()
self.send_signal(self.widget.Inputs.data, None)
input_sum.assert_called_once()
self.assertIsInstance(input_sum.call_args[0][0], StateInfo.Empty)
output_sum.assert_called_once()
self.assertIsInstance(output_sum.call_args[0][0], StateInfo.Empty)

def test_select_method(self):
widget = self.widget
data = Table("iris")[::5]
Expand Down
39 changes: 0 additions & 39 deletions Orange/widgets/data/tests/test_oweditdomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,45 +318,6 @@ def restore(state):
tr = model.data(model.index(4), TransformRole)
self.assertEqual(tr, [AsString(), Rename("Z")])

def test_summary(self):
"""Check if status bar is updated when data is received"""
data = Table("iris")
input_sum = self.widget.info.set_input_summary = Mock()
output_sum = self.widget.info.set_output_summary = Mock()

self.send_signal(self.widget.Inputs.data, data)
input_sum.assert_called_with(len(data), format_summary_details(data))
output = self.get_output(self.widget.Outputs.data)
output_sum.assert_called_with(len(output),
format_summary_details(output))

def enter_text(widget, text):
# type: (QLineEdit, str) -> None
widget.selectAll()
QTest.keyClick(widget, Qt.Key_Delete)
QTest.keyClicks(widget, text)
QTest.keyClick(widget, Qt.Key_Return)

editor = self.widget.findChild(ContinuousVariableEditor)
enter_text(editor.name_edit, "sepal height")
self.widget.commit()
output = self.get_output(self.widget.Outputs.data)
output_sum.assert_called_with(len(output),
format_summary_details(output))
output_sum.reset_mock()
enter_text(editor.name_edit, "sepal width")
self.widget.commit()
output_sum.assert_called_once()
self.assertIsInstance(output_sum.call_args[0][0], StateInfo.Empty)

input_sum.reset_mock()
output_sum.reset_mock()
self.send_signal(self.widget.Inputs.data, None)
input_sum.assert_called_once()
self.assertIsInstance(input_sum.call_args[0][0], StateInfo.Empty)
output_sum.assert_called_once()
self.assertIsInstance(output_sum.call_args[0][0], StateInfo.Empty)


class TestEditors(GuiTest):
def test_variable_editor(self):
Expand Down
20 changes: 0 additions & 20 deletions Orange/widgets/data/tests/test_owfeatureconstructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,26 +361,6 @@ def test_discrete_no_values(self):
self.widget.apply()
self.assertTrue(self.widget.Error.more_values_needed.is_shown())

def test_summary(self):
"""Check if status bar is updated when data is received"""
data = Table("iris")
input_sum = self.widget.info.set_input_summary = Mock()
output_sum = self.widget.info.set_output_summary = Mock()

self.send_signal(self.widget.Inputs.data, data)
input_sum.assert_called_with(len(data), format_summary_details(data))
output = self.get_output(self.widget.Outputs.data)
output_sum.assert_called_with(len(output),
format_summary_details(output))

input_sum.reset_mock()
output_sum.reset_mock()
self.send_signal(self.widget.Inputs.data, None)
input_sum.assert_called_once()
self.assertIsInstance(input_sum.call_args[0][0], StateInfo.Empty)
output_sum.assert_called_once()
self.assertIsInstance(output_sum.call_args[0][0], StateInfo.Empty)


class TestFeatureEditor(unittest.TestCase):
def test_has_functions(self):
Expand Down
22 changes: 0 additions & 22 deletions Orange/widgets/data/tests/test_owfeaturestatistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,28 +514,6 @@ def setUp(self):
)
self.select_rows = partial(select_rows, widget=self.widget)

def test_summary(self):
"""Check if the status bar is updated when data is received"""
data = self.data
input_sum = self.widget.info.set_input_summary = Mock()
output_sum = self.widget.info.set_output_summary = Mock()

self.send_signal(self.widget.Inputs.data, data)
input_sum.assert_called_with(len(data), format_summary_details(data))

self.select_rows([0, 2])
self.widget.unconditional_commit()
output = self.get_output(self.widget.Outputs.reduced_data)
output_sum.assert_called_with(len(output), format_summary_details(output))

input_sum.reset_mock()
output_sum.reset_mock()
self.send_signal(self.widget.Inputs.data, None)
input_sum.assert_called_once()
self.assertIsInstance(input_sum.call_args[0][0], StateInfo.Empty)
output_sum.assert_called_once()
self.assertIsInstance(output_sum.call_args[0][0], StateInfo.Empty)


if __name__ == "__main__":
unittest.main()
8 changes: 0 additions & 8 deletions Orange/widgets/data/tests/test_owfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,14 +546,6 @@ def test_adds_origin(self):
self.assertIn("origin", attrs)
self.assertIn("origin1", attrs["origin"])

def test_summary(self):
"""Check if the status bar is updated when data is received"""
output_sum = self.widget.info.set_output_summary = Mock()
self.open_dataset("iris")
output = self.get_output(self.widget.Outputs.data)
output_sum.assert_called_with(len(output),
format_summary_details(output))

@patch("Orange.widgets.widget.OWWidget.workflowEnv",
Mock(return_value={"basedir": getcwd()}))
def test_open_moved_workflow(self):
Expand Down
25 changes: 0 additions & 25 deletions Orange/widgets/data/tests/test_owimpute.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,28 +215,3 @@ def effective_method(var):
self.assertEqual(varbg.checkedId(), Method.Default)
self.assertEqual(widget.value_combo.currentIndex(), 1)

def test_summary(self):
"""Check if the status bar is updated when data is received"""
data = Table("heart_disease")
input_sum = self.widget.info.set_input_summary = Mock()
output_sum = self.widget.info.set_output_summary = Mock()

self.send_signal(self.widget.Inputs.data, data)
input_sum.assert_called_with(len(data), format_summary_details(data))
output = self.get_output(self.widget.Outputs.data)
output_sum.assert_called_with(len(output),
format_summary_details(output))

varbg = self.widget.variable_button_group
varbg.button(Method.AsValue).click()
output = self.get_output(self.widget.Outputs.data)
output_sum.assert_called_with(len(output),
format_summary_details(output))

input_sum.reset_mock()
output_sum.reset_mock()
self.send_signal(self.widget.Inputs.data, None)
input_sum.assert_called_once()
self.assertIsInstance(input_sum.call_args[0][0], StateInfo.Empty)
output_sum.assert_called_once()
self.assertIsInstance(output_sum.call_args[0][0], StateInfo.Empty)
33 changes: 0 additions & 33 deletions Orange/widgets/data/tests/test_owpivot.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,39 +245,6 @@ def test_send_report(self):
self.send_signal(self.widget.Inputs.data, None)
self.widget.report_button.click()

def test_summary(self):
"""Check if the status bar is updated when data is received"""
data = self.iris
input_sum = self.widget.info.set_input_summary = Mock()
output_sum = self.widget.info.set_output_summary = Mock()

self.send_signal(self.widget.Inputs.data, data)
input_sum.assert_called_with(len(data), format_summary_details(data))
output = self.get_output(self.widget.Outputs.filtered_data)
self.assertIsNone(output)
simulate.combobox_activate_item(self.widget.controls.row_feature,
self.iris.domain.attributes[0].name)
simulate.combobox_activate_item(self.widget.controls.col_feature,
self.iris.domain.class_var.name)
self.widget.table_view.set_selection(set([(11, 0), (11, 1), (12, 0)]))
self.widget.table_view.selection_changed.emit()
filtered = self.get_output(self.widget.Outputs.filtered_data)
pivot = self.get_output(self.widget.Outputs.pivot_table)
grouped = self.get_output(self.widget.Outputs.grouped_data)
output_sum.assert_called_with(
f"{len(pivot)}, {len(filtered)}, {len(grouped)}",
format_multiple_summaries([("Pivot table", pivot),
("Filtered data", filtered),
("Grouped data", grouped)]),
format=1)
input_sum.reset_mock()
output_sum.reset_mock()
self.send_signal(self.widget.Inputs.data, None)
input_sum.assert_called_once()
self.assertIsInstance(input_sum.call_args[0][0], StateInfo.Empty)
output_sum.assert_called_once()
self.assertIsInstance(output_sum.call_args[0][0], StateInfo.Empty)

def test_renaming_warning(self):
data = Table('iris')
cls_var = data.domain.class_var.copy(name='Aggregate')
Expand Down
20 changes: 0 additions & 20 deletions Orange/widgets/data/tests/test_owpreprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,26 +142,6 @@ def test_data_column_nans(self):
self.widget.set_model(model)
self.send_signal(self.widget.Inputs.data, table)

def test_summary(self):
"""Check if status bar is updated when data is received"""
data = Table("iris")
input_sum = self.widget.info.set_input_summary = Mock()
output_sum = self.widget.info.set_output_summary = Mock()

self.send_signal(self.widget.Inputs.data, data)
input_sum.assert_called_with(len(data), format_summary_details(data))
output = self.get_output(self.widget.Outputs.preprocessed_data)
output_sum.assert_called_with(len(output),
format_summary_details(output))

input_sum.reset_mock()
output_sum.reset_mock()
self.send_signal(self.widget.Inputs.data, None)
input_sum.assert_called_once()
self.assertIsInstance(input_sum.call_args[0][0], StateInfo.Empty)
output_sum.assert_called_once()
self.assertIsInstance(output_sum.call_args[0][0], StateInfo.Empty)


# Test for editors
class TestDiscretizeEditor(WidgetTest):
Expand Down
Loading

0 comments on commit 3fbbfe9

Please sign in to comment.