From 2dc706e23db340623d8dceae439b196d52e4ad58 Mon Sep 17 00:00:00 2001 From: Vesna Tanko Date: Fri, 14 Dec 2018 12:08:24 +0100 Subject: [PATCH] TestOWtSNE: Update --- .../widgets/unsupervised/tests/test_owtsne.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Orange/widgets/unsupervised/tests/test_owtsne.py b/Orange/widgets/unsupervised/tests/test_owtsne.py index 2daa320ed2a..1cfede067cf 100644 --- a/Orange/widgets/unsupervised/tests/test_owtsne.py +++ b/Orange/widgets/unsupervised/tests/test_owtsne.py @@ -1,6 +1,8 @@ import unittest import numpy as np +from AnyQt.QtTest import QSignalSpy + from Orange.data import DiscreteVariable, ContinuousVariable, Domain, Table from Orange.preprocess import Preprocess from Orange.projection.manifold import TSNE @@ -39,7 +41,8 @@ def optimize(*_, **__): owtsne.TSNEModel.transform = transform owtsne.TSNEModel.optimize = optimize - self.widget = self.create_widget(OWtSNE) + self.widget = self.create_widget(OWtSNE, + stored_settings={"multiscale": False}) self.class_var = DiscreteVariable('Stage name', values=['STG1', 'STG2']) self.attributes = [ContinuousVariable('GeneName' + str(i)) for i in range(5)] @@ -110,7 +113,11 @@ def test_attr_models(self): self.assertIn(var, controls.attr_shape.model()) def test_output_preprocessor(self): + self.reset_tsne() self.send_signal(self.widget.Inputs.data, self.data) + if self.widget.isBlocking(): + spy = QSignalSpy(self.widget.blockingStateChanged) + self.assertTrue(spy.wait(20000)) pp = self.get_output(self.widget.Outputs.preprocessor) self.assertIsInstance(pp, Preprocess) transformed = pp(self.data) @@ -123,15 +130,15 @@ def test_output_preprocessor(self): [m.name for m in output.domain.metas[:2]]) def test_multiscale_changed(self): - self.assertTrue(self.widget.controls.multiscale.isChecked()) - self.assertFalse(self.widget.perplexity_spin.isEnabled()) - self.widget.controls.multiscale.setChecked(False) + self.assertFalse(self.widget.controls.multiscale.isChecked()) self.assertTrue(self.widget.perplexity_spin.isEnabled()) + self.widget.controls.multiscale.setChecked(True) + self.assertFalse(self.widget.perplexity_spin.isEnabled()) settings = self.widget.settingsHandler.pack_data(self.widget) w = self.create_widget(OWtSNE, stored_settings=settings) - self.assertFalse(w.controls.multiscale.isChecked()) - self.assertTrue(w.perplexity_spin.isEnabled()) + self.assertTrue(w.controls.multiscale.isChecked()) + self.assertFalse(w.perplexity_spin.isEnabled()) if __name__ == '__main__':