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

scipy-svn@scip... scipy-svn@scip...
Mon Aug 25 07:33:59 CDT 2008


Author: damian.eads
Date: 2008-08-25 07:33:58 -0500 (Mon, 25 Aug 2008)
New Revision: 4675

Modified:
   trunk/scipy/cluster/tests/test_distance.py
Log:
Added tests for Canberra bug reported in ticket 711.

Modified: trunk/scipy/cluster/tests/test_distance.py
===================================================================
--- trunk/scipy/cluster/tests/test_distance.py	2008-08-25 12:10:57 UTC (rev 4674)
+++ trunk/scipy/cluster/tests/test_distance.py	2008-08-25 12:33:58 UTC (rev 4675)
@@ -945,7 +945,7 @@
         self.failUnless(within_tol(y1, y2, eps))
 
     def test_pdist_canberra_match(self):
-        "Tests pdist(X, 'canberra') to see if the two implementations match on random double input data."
+        "Tests pdist(X, 'canberra') to see if the two implementations match on the Iris data set."
         D = eo['iris']
         print D.shape, D.dtype
         eps = 1e-10
@@ -954,6 +954,13 @@
         print np.abs(y1-y2).max()
         self.failUnless(within_tol(y1, y2, eps))
 
+    def test_pdist_canberra_ticket_711(self):
+        "Tests pdist(X, 'canberra') to see if Canberra gives the right result as reported in Scipy bug report 711."
+        eps = 1e-10
+        pdist_y = pdist(([3.3], [3.4]), "canberra")
+        right_y = array([ 0.01492537])
+        print np.abs(pdist_y-right_y).max()
+        self.failUnless(within_tol(y1, y2, eps))
 
 def within_tol(a, b, tol):
     return np.abs(a - b).max() < tol



More information about the Scipy-svn mailing list