diff --git a/orangecontrib/text/widgets/owstatistics.py b/orangecontrib/text/widgets/owstatistics.py index 98a86c570..5fd928fa0 100644 --- a/orangecontrib/text/widgets/owstatistics.py +++ b/orangecontrib/text/widgets/owstatistics.py @@ -408,7 +408,8 @@ def __call__(self, data: Corpus) -> np.ndarray: return self.function(data, self.pattern, self.source, lambda: True)[0] def __eq__(self, other): - return self.function == other.function and self.pattern == other.pattern + return type(self) is type(other) and self.function == other.function \ + and self.pattern == other.pattern def __hash__(self): return hash((self.function, self.pattern)) diff --git a/orangecontrib/text/widgets/tests/test_owstatistics.py b/orangecontrib/text/widgets/tests/test_owstatistics.py index 20e3a8ca1..fc9a9abdf 100644 --- a/orangecontrib/text/widgets/tests/test_owstatistics.py +++ b/orangecontrib/text/widgets/tests/test_owstatistics.py @@ -4,6 +4,7 @@ from AnyQt.QtWidgets import QPushButton from Orange.data import Domain, StringVariable +from Orange.preprocess import SklImpute from Orange.widgets.tests.base import WidgetTest from Orange.widgets.tests.utils import simulate from orangecontrib.text import Corpus @@ -521,6 +522,12 @@ def test_migrate_settings(self): ] self.assertListEqual(expected, widget.active_rules) + def test_preprocess_output(self): + self.send_signal(self.widget.Inputs.corpus, self.corpus) + output = self.get_output(self.widget.Outputs.corpus) + imputed = SklImpute()(output) + self.assertIsNotNone(imputed) + if __name__ == "__main__": unittest.main()