-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ENH] ApplyDomain: data info displayed in the status bar #4611
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Test methods with long descriptive names can omit docstrings | ||
# pylint: disable=missing-docstring | ||
# pylint: disable=missing-docstring, protected-access | ||
from unittest.mock import Mock | ||
|
||
from numpy import testing as npt | ||
|
@@ -9,6 +9,8 @@ | |
from Orange.widgets.data.owtransform import OWTransform | ||
from Orange.widgets.tests.base import WidgetTest | ||
from Orange.widgets.unsupervised.owpca import OWPCA | ||
from Orange.widgets.utils.state_summary import format_summary_details, \ | ||
format_multiple_summaries | ||
|
||
|
||
class TestOWTransform(WidgetTest): | ||
|
@@ -19,6 +21,8 @@ def setUp(self): | |
|
||
def test_output(self): | ||
# send data and template data | ||
info = self.widget.info | ||
no_input, no_output = "No data on input", "No data on output" | ||
self.send_signal(self.widget.Inputs.data, self.data[::15]) | ||
self.send_signal(self.widget.Inputs.template_data, self.disc_data) | ||
output = self.get_output(self.widget.Outputs.transformed_data) | ||
|
@@ -29,6 +33,13 @@ def test_output(self): | |
self.widget.template_label.text()) | ||
self.assertEqual("Output data includes 4 features.", | ||
self.widget.output_label.text()) | ||
data_list = [("Data", self.data[::15]), ("Template data", self.disc_data)] | ||
summary, details = "10, 150", format_multiple_summaries(data_list) | ||
self.assertEqual(info._StateInfo__input_summary.brief, summary) | ||
self.assertEqual(info._StateInfo__input_summary.details, details) | ||
summary, details = "10", format_summary_details(output) | ||
self.assertEqual(info._StateInfo__output_summary.brief, summary) | ||
self.assertEqual(info._StateInfo__output_summary.details, details) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An extra line can be removed. |
||
# remove template data | ||
self.send_signal(self.widget.Inputs.template_data, None) | ||
|
@@ -39,6 +50,12 @@ def test_output(self): | |
self.assertEqual("No template data on input.", | ||
self.widget.template_label.text()) | ||
self.assertEqual("", self.widget.output_label.text()) | ||
data_list = [("Data", self.data[::15]), ("Template data", None)] | ||
summary, details = "10, 0", format_multiple_summaries(data_list) | ||
self.assertEqual(info._StateInfo__input_summary.brief, summary) | ||
self.assertEqual(info._StateInfo__input_summary.details, details) | ||
self.assertEqual(info._StateInfo__output_summary.brief, "") | ||
self.assertEqual(info._StateInfo__output_summary.details, no_output) | ||
|
||
# send template data | ||
self.send_signal(self.widget.Inputs.template_data, self.disc_data) | ||
|
@@ -59,13 +76,23 @@ def test_output(self): | |
self.assertEqual("Template data includes 4 features.", | ||
self.widget.template_label.text()) | ||
self.assertEqual("", self.widget.output_label.text()) | ||
data_list = [("Data", None), ("Template data", self.disc_data)] | ||
summary, details = "0, 150", format_multiple_summaries(data_list) | ||
self.assertEqual(info._StateInfo__input_summary.brief, summary) | ||
self.assertEqual(info._StateInfo__input_summary.details, details) | ||
self.assertEqual(info._StateInfo__output_summary.brief, "") | ||
self.assertEqual(info._StateInfo__output_summary.details, no_output) | ||
|
||
# remove template data | ||
self.send_signal(self.widget.Inputs.template_data, None) | ||
self.assertEqual("No data on input.", self.widget.input_label.text()) | ||
self.assertEqual("No template data on input.", | ||
self.widget.template_label.text()) | ||
self.assertEqual("", self.widget.output_label.text()) | ||
self.assertEqual(info._StateInfo__input_summary.brief, "") | ||
self.assertEqual(info._StateInfo__input_summary.details, no_input) | ||
self.assertEqual(info._StateInfo__output_summary.brief, "") | ||
self.assertEqual(info._StateInfo__output_summary.details, no_output) | ||
|
||
def assertTableEqual(self, table1, table2): | ||
self.assertIs(table1.domain, table2.domain) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since
self.template_data
has been introducesself.template_domain
is no longer needed.