Skip to content

Commit

Permalink
Merge pull request #1076 from VesnaT/statistics_compute_value
Browse files Browse the repository at this point in the history
[FIX] Statistics: Fix ComputeValue.__eq__
  • Loading branch information
markotoplak authored Aug 29, 2024
2 parents ab8ef47 + a194f75 commit c51e33b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion orangecontrib/text/widgets/owstatistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
7 changes: 7 additions & 0 deletions orangecontrib/text/widgets/tests/test_owstatistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

0 comments on commit c51e33b

Please sign in to comment.