[pypy-svn] r10357 - in pypy/dist/pypy/objspace/flow: . test

pedronis at codespeak.net pedronis at codespeak.net
Wed Apr 6 12:51:11 CEST 2005


Author: pedronis
Date: Wed Apr  6 12:51:10 2005
New Revision: 10357

Modified:
   pypy/dist/pypy/objspace/flow/specialcase.py
   pypy/dist/pypy/objspace/flow/test/test_objspace.py
Log:
2.2 compatibility is not a good reason to break tests!



Modified: pypy/dist/pypy/objspace/flow/specialcase.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/specialcase.py	(original)
+++ pypy/dist/pypy/objspace/flow/specialcase.py	Wed Apr  6 12:51:10 2005
@@ -26,5 +26,8 @@
     # space.specialcases[fn] = sc_normalize_exception
     if space.do_imports_immediately:
         space.specialcases[__import__] = sc_import
-    for opname in ['lt', 'le', 'eq', 'ne', 'gt', 'ge']:
-        space.specialcases[getattr(operator, opname)] = sc_operator
+    for opname in ['lt', 'le', 'eq', 'ne', 'gt', 'ge', 'is_']:
+        opfunc = getattr(operator, opname, None)
+        if opfunc is None:
+            continue
+        space.specialcases[opfunc] = sc_operator

Modified: pypy/dist/pypy/objspace/flow/test/test_objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/test/test_objspace.py	(original)
+++ pypy/dist/pypy/objspace/flow/test/test_objspace.py	Wed Apr  6 12:51:10 2005
@@ -3,9 +3,11 @@
 from pypy.interpreter.argument import Arguments
 from pypy.translator.simplify import simplify_graph
 
-
 objspacename = 'flow'
 
+import operator
+is_operator = getattr(operator, 'is_', operator.eq) # it's not there 2.2
+
 class TestFlowObjSpace:
     def codetest(self, func):
         import inspect
@@ -330,6 +332,7 @@
         self.show(x)
 
     #__________________________________________________________
+    
     def specialcases():
         import operator
         operator.lt(2,3)
@@ -338,7 +341,7 @@
         operator.ne(2,3)
         operator.gt(2,3)
         operator.ge(2,3)
-        operator.is_(2,3)
+        is_operator(2,3)
         operator.__lt__(2,3)
         operator.__le__(2,3)
         operator.__eq__(2,3)



More information about the Pypy-commit mailing list