[Scipy-svn] r3490 - in trunk/scipy/stats/models: . tests

scipy-svn@scip... scipy-svn@scip...
Fri Nov 2 10:53:42 CDT 2007


Author: cookedm
Date: 2007-11-02 10:53:40 -0500 (Fri, 02 Nov 2007)
New Revision: 3490

Modified:
   trunk/scipy/stats/models/formula.py
   trunk/scipy/stats/models/tests/test_formula.py
Log:
scipy.stats.models: Python 2.3 workaround for 'set'. Fixes #528.


Modified: trunk/scipy/stats/models/formula.py
===================================================================
--- trunk/scipy/stats/models/formula.py	2007-11-02 15:50:57 UTC (rev 3489)
+++ trunk/scipy/stats/models/formula.py	2007-11-02 15:53:40 UTC (rev 3490)
@@ -5,6 +5,11 @@
 import types
 import numpy as N
 
+try:
+    set
+except NameError:
+    from sets import Set as set
+
 __docformat__ = 'restructuredtext'
 
 default_namespace = {}

Modified: trunk/scipy/stats/models/tests/test_formula.py
===================================================================
--- trunk/scipy/stats/models/tests/test_formula.py	2007-11-02 15:50:57 UTC (rev 3489)
+++ trunk/scipy/stats/models/tests/test_formula.py	2007-11-02 15:53:40 UTC (rev 3490)
@@ -187,26 +187,26 @@
 
     def test_factor1(self):
         f = ['a','b','c']*10
-        fac = formula.Factor('ff', set(f))
+        fac = formula.Factor('ff', f)
         fac.namespace = {'ff':f}
         self.assertEquals(list(fac.values()), f)
 
     def test_factor2(self):
         f = ['a','b','c']*10
-        fac = formula.Factor('ff', set(f))
+        fac = formula.Factor('ff', f)
         fac.namespace = {'ff':f}
         self.assertEquals(fac().shape, (3,30))
 
     def test_factor3(self):
         f = ['a','b','c']*10
-        fac = formula.Factor('ff', set(f))
+        fac = formula.Factor('ff', f)
         fac.namespace = {'ff':f}
         m = fac.main_effect(reference=1)
         self.assertEquals(m().shape, (2,30))
 
     def test_factor4(self):
         f = ['a','b','c']*10
-        fac = formula.Factor('ff', set(f))
+        fac = formula.Factor('ff', f)
         fac.namespace = {'ff':f}
         m = fac.main_effect(reference=2)
         r = N.array([N.identity(3)]*10)



More information about the Scipy-svn mailing list