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

scipy-svn@scip... scipy-svn@scip...
Wed Nov 5 05:03:33 CST 2008


Author: cdavid
Date: 2008-11-05 05:03:25 -0600 (Wed, 05 Nov 2008)
New Revision: 4994

Modified:
   trunk/scipy/cluster/tests/test_vq.py
Log:
Do not display warning when running test for kmean cluster error.

Modified: trunk/scipy/cluster/tests/test_vq.py
===================================================================
--- trunk/scipy/cluster/tests/test_vq.py	2008-11-04 16:32:55 UTC (rev 4993)
+++ trunk/scipy/cluster/tests/test_vq.py	2008-11-05 11:03:25 UTC (rev 4994)
@@ -1,9 +1,10 @@
 #! /usr/bin/env python
 
 # David Cournapeau
-# Last Change: Tue Jun 24 04:00 PM 2008 J
+# Last Change: Wed Nov 05 07:00 PM 2008 J
 
 import os.path
+import warnings
 
 import numpy as np
 from numpy.testing import *
@@ -98,7 +99,12 @@
                          [-2.31149087,-0.05160469]])
 
         res = kmeans(data, initk)
-        res = kmeans2(data, initk, missing = 'warn')
+        warnings.simplefilter('ignore', UserWarning)
+        try:
+            res = kmeans2(data, initk, missing = 'warn')
+        finally:
+            warnings.simplefilter('default', UserWarning)
+
         try :
             res = kmeans2(data, initk, missing = 'raise')
             raise AssertionError("Exception not raised ! Should not happen")



More information about the Scipy-svn mailing list