From e934458c23d02c7e50f6c124873005b4ffefbebe Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Mon, 24 Aug 2020 14:11:20 +0200 Subject: [PATCH 1/2] owheatmap: Remove assert coditions (off by one) --- Orange/widgets/visualize/owheatmap.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Orange/widgets/visualize/owheatmap.py b/Orange/widgets/visualize/owheatmap.py index caa30c24aa5..9d8daf79d9b 100644 --- a/Orange/widgets/visualize/owheatmap.py +++ b/Orange/widgets/visualize/owheatmap.py @@ -796,12 +796,10 @@ def cluster_rows(self, data: Table, parts: 'Parts', ordered=False) -> 'Parts': matrix = Orange.distance.Euclidean(subset) if cluster is None: - assert len(matrix) < self.MaxClustering cluster = hierarchical.dist_matrix_clustering( matrix, linkage=hierarchical.WARD ) if ordered and cluster_ord is None: - assert len(matrix) < self.MaxOrderedClustering cluster_ord = hierarchical.optimal_leaf_ordering( cluster, matrix, ) @@ -833,12 +831,10 @@ def cluster_columns(self, data, parts: 'Parts', ordered=False): if cluster is None: assert matrix is not None - assert len(matrix) < self.MaxClustering cluster = hierarchical.dist_matrix_clustering( matrix, linkage=hierarchical.WARD ) if ordered and cluster_ord is None: - assert len(matrix) < self.MaxOrderedClustering cluster_ord = hierarchical.optimal_leaf_ordering(cluster, matrix) col_groups.append(col._replace(cluster=cluster, cluster_ordered=cluster_ord)) From 40ee219187788ac069a59cd999bdfca15f86c55c Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Tue, 25 Aug 2020 09:33:07 +0200 Subject: [PATCH 2/2] test_owheatmap: Test limits --- Orange/widgets/visualize/tests/test_owheatmap.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Orange/widgets/visualize/tests/test_owheatmap.py b/Orange/widgets/visualize/tests/test_owheatmap.py index 97369421f16..28cd6e4002c 100644 --- a/Orange/widgets/visualize/tests/test_owheatmap.py +++ b/Orange/widgets/visualize/tests/test_owheatmap.py @@ -62,13 +62,18 @@ def test_error_message(self): def test_information_message(self): self.widget.set_row_clustering(Clustering.OrderedClustering) - continuizer = Continuize() - cont_titanic = continuizer(self.titanic) - self.widget.MaxClustering = 1000 - self.send_signal(self.widget.Inputs.data, cont_titanic) + self.widget.MaxClustering = 20 + self.widget.MaxOrderedClustering = 15 + data = self.brown_selected[:, :10] + self.send_signal(self.widget.Inputs.data, data[:15]) + self.assertFalse(self.widget.Information.active) + self.send_signal(self.widget.Inputs.data, data[:16]) self.assertTrue(self.widget.Information.active) - self.send_signal(self.widget.Inputs.data, self.data) + self.assertEqual(self.widget.row_clustering, Clustering.Clustering) + self.send_signal(self.widget.Inputs.data, data[:20]) self.assertFalse(self.widget.Information.active) + self.send_signal(self.widget.Inputs.data, data[:21]) + self.assertTrue(self.widget.Information.active) def test_settings_changed(self): self.send_signal(self.widget.Inputs.data, self.data)