[Scipy-svn] r5189 - trunk/scipy/cluster/tests
scipy-svn at scipy.org
scipy-svn at scipy.org
Mon Nov 24 23:49:17 EST 2008
Author: damian.eads
Date: 2008-11-24 22:49:16 -0600 (Mon, 24 Nov 2008)
New Revision: 5189
Modified:
trunk/scipy/cluster/tests/test_hierarchy.py
Log:
Wrote tests for scipy.hierarchy.leaves_list.
Modified: trunk/scipy/cluster/tests/test_hierarchy.py
===================================================================
--- trunk/scipy/cluster/tests/test_hierarchy.py 2008-11-25 04:46:23 UTC (rev 5188)
+++ trunk/scipy/cluster/tests/test_hierarchy.py 2008-11-25 04:49:16 UTC (rev 5189)
@@ -708,7 +708,6 @@
Z = np.zeros((0, 4), dtype=np.double)
self.failUnlessRaises(ValueError, num_obs_linkage, Z)
-
def test_num_obs_linkage_1x4(self):
"Tests num_obs_linkage(Z) on linkage over 2 observations."
Z = np.asarray([[0, 1, 3.0, 2]], dtype=np.double)
@@ -729,6 +728,19 @@
class TestLeavesList(TestCase):
+ def test_leaves_list_1x4(self):
+ "Tests leaves_list(Z) on a 1x4 linkage."
+ Z = np.asarray([[0, 1, 3.0, 2]], dtype=np.double)
+ node = to_tree(Z)
+ self.failUnless((leaves_list(Z) == [0, 1]).all())
+
+ def test_leaves_list_1x4(self):
+ "Tests leaves_list(Z) on a 1x4 linkage."
+ Z = np.asarray([[0, 1, 3.0, 2],
+ [3, 2, 4.0, 3]], dtype=np.double)
+ node = to_tree(Z)
+ self.failUnless((leaves_list(Z) == [0, 1, 2]).all())
+
def test_leaves_list_iris_single(self):
"Tests leaves_list(Z) on the Iris data set using single linkage."
X = eo['iris']
More information about the Scipy-svn
mailing list