[Scipy-svn] r5014 - trunk/scipy/cluster/tests

scipy-svn@scip... scipy-svn@scip...
Fri Nov 7 14:57:53 CST 2008


Author: damian.eads
Date: 2008-11-07 14:57:48 -0600 (Fri, 07 Nov 2008)
New Revision: 5014

Added:
   trunk/scipy/cluster/tests/fclusterdata-maxclusts-2.txt
   trunk/scipy/cluster/tests/fclusterdata-maxclusts-4.txt
Modified:
   trunk/scipy/cluster/tests/test_hierarchy.py
Log:
Added data files for new tests.

Added: trunk/scipy/cluster/tests/fclusterdata-maxclusts-2.txt
===================================================================
--- trunk/scipy/cluster/tests/fclusterdata-maxclusts-2.txt	2008-11-07 20:49:18 UTC (rev 5013)
+++ trunk/scipy/cluster/tests/fclusterdata-maxclusts-2.txt	2008-11-07 20:57:48 UTC (rev 5014)
@@ -0,0 +1,30 @@
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   1.0000000e+00
+   1.0000000e+00
+   1.0000000e+00
+   1.0000000e+00
+   1.0000000e+00
+   1.0000000e+00
+   1.0000000e+00
+   1.0000000e+00
+   1.0000000e+00
+   1.0000000e+00

Added: trunk/scipy/cluster/tests/fclusterdata-maxclusts-4.txt
===================================================================
--- trunk/scipy/cluster/tests/fclusterdata-maxclusts-4.txt	2008-11-07 20:49:18 UTC (rev 5013)
+++ trunk/scipy/cluster/tests/fclusterdata-maxclusts-4.txt	2008-11-07 20:57:48 UTC (rev 5014)
@@ -0,0 +1,30 @@
+   3.0000000e+00
+   3.0000000e+00
+   3.0000000e+00
+   3.0000000e+00
+   3.0000000e+00
+   3.0000000e+00
+   3.0000000e+00
+   3.0000000e+00
+   3.0000000e+00
+   3.0000000e+00
+   4.0000000e+00
+   4.0000000e+00
+   4.0000000e+00
+   4.0000000e+00
+   4.0000000e+00
+   4.0000000e+00
+   4.0000000e+00
+   4.0000000e+00
+   4.0000000e+00
+   4.0000000e+00
+   1.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00
+   2.0000000e+00

Modified: trunk/scipy/cluster/tests/test_hierarchy.py
===================================================================
--- trunk/scipy/cluster/tests/test_hierarchy.py	2008-11-07 20:49:18 UTC (rev 5013)
+++ trunk/scipy/cluster/tests/test_hierarchy.py	2008-11-07 20:57:48 UTC (rev 5014)
@@ -54,7 +54,10 @@
 eo = {}
 
 _filenames = ["iris.txt",
-              "mlab-random.txt",
+              "fclusterdata-X.txt",
+              "fclusterdata-maxclusts-1.txt",
+              "fclusterdata-maxclusts-2.txt",
+              "fclusterdata-maxclusts-3.txt",
               "linkage-single-tdist.txt",
               "linkage-complete-tdist.txt",
               "linkage-average-tdist.txt",
@@ -249,10 +252,12 @@
 
 class TestFcluster(TestCase):
 
-    def test_fcluster(self):
+    def test_fclusterdata_maxclusts_3(self):
         "Tests fclusterdata with 'maxclusts' criterion with maxclusts=3."
+        expectedT = eo['fclusterdata-maxclusts-3']
+        T = hi.fcluster(Z, criterion='maxclust', t=3)
+        self.failUnless((expectedT == T).all())
 
-
 def help_single_inconsistent_depth(self, i):
     Y = squareform(_tdist)
     Z = linkage(Y, 'single')



More information about the Scipy-svn mailing list