[Numpy-svn] r3700 - trunk/numpy/lib/tests

numpy-svn@scip... numpy-svn@scip...
Tue Apr 10 21:10:01 CDT 2007


Author: eric
Date: 2007-04-10 21:09:59 -0500 (Tue, 10 Apr 2007)
New Revision: 3700

Modified:
   trunk/numpy/lib/tests/test_function_base.py
Log:
added simple test for weighted average

Modified: trunk/numpy/lib/tests/test_function_base.py
===================================================================
--- trunk/numpy/lib/tests/test_function_base.py	2007-04-11 02:05:06 UTC (rev 3699)
+++ trunk/numpy/lib/tests/test_function_base.py	2007-04-11 02:09:59 UTC (rev 3700)
@@ -57,6 +57,13 @@
         assert_array_equal(y5.mean(0), average(y5, 0))
         assert_array_equal(y5.mean(1), average(y5, 1))
 
+    def check_weighted(self):
+        y1 = array([[1,2,3],
+                    [4,5,6]])
+        actual = average(y1,weights=[1,2],axis=0)            
+        desired = array([3.,4.,5.])
+        assert_array_equal(actual, desired)
+
 class test_logspace(NumpyTestCase):
     def check_basic(self):
         y = logspace(0,6)



More information about the Numpy-svn mailing list