|
1 | | -# Test methods with long descriptive names can omit docstrings |
2 | | -# pylint: disable=missing-docstring |
| 1 | +from unittest.mock import Mock |
| 2 | + |
3 | 3 | from Orange.widgets.data.owtable import OWDataTable |
4 | 4 | from Orange.widgets.tests.base import WidgetTest, WidgetOutputsTestMixin |
5 | | -from Orange.data import Table |
| 5 | +from Orange.data import Table, Domain |
6 | 6 |
|
7 | 7 |
|
8 | 8 | class TestOWDataTable(WidgetTest, WidgetOutputsTestMixin): |
@@ -43,3 +43,16 @@ def _select_data(self): |
43 | 43 | self.widget.selected_rows = list(range(0, len(self.data.domain), 10)) |
44 | 44 | self.widget.set_selection() |
45 | 45 | return self.widget.selected_rows |
| 46 | + |
| 47 | + def test_attrs_appear_in_corner_text(self): |
| 48 | + iris = Table("iris") |
| 49 | + domain = iris.domain |
| 50 | + new_domain = Domain( |
| 51 | + domain.attributes[1:], iris.domain.class_var, domain.attributes[:1]) |
| 52 | + new_domain.metas[0].attributes = {"c": "foo"} |
| 53 | + new_domain.attributes[0].attributes = {"a": "bar", "c": "baz"} |
| 54 | + new_domain.class_var.attributes = {"b": "foo"} |
| 55 | + self.widget.set_corner_text = Mock() |
| 56 | + self.send_signal(self.widget.Inputs.data, iris.transform(new_domain)) |
| 57 | + self.assertEqual( |
| 58 | + self.widget.set_corner_text.call_args[0][1], "\na\nb\nc") |
0 commit comments