[pypy-svn] r59532 - in pypy/trunk/lib-python: . modified-2.5.2/test

arigo at codespeak.net arigo at codespeak.net
Thu Oct 30 11:01:18 CET 2008


Author: arigo
Date: Thu Oct 30 11:01:18 2008
New Revision: 59532

Added:
   pypy/trunk/lib-python/modified-2.5.2/test/test_coercion.py
      - copied, changed from r59521, pypy/trunk/lib-python/2.5.2/test/test_coercion.py
Modified:
   pypy/trunk/lib-python/failure_list.txt
Log:
Marked this as implementation-specific, with justification.
test_coercion now passes.


Modified: pypy/trunk/lib-python/failure_list.txt
==============================================================================
--- pypy/trunk/lib-python/failure_list.txt	(original)
+++ pypy/trunk/lib-python/failure_list.txt	Thu Oct 30 11:01:18 2008
@@ -14,9 +14,6 @@
 test_codeccallbacks          !   unknown
 test_codecs                  !   unknown
 test_coding                  !   hah.  fix buildbot :-/
-test_coercion            arigo   look at test_prefix_binops, the other is probably too obscure
-                                 problem with prebuilt objects being equal in result list creation
-
 test_commands                !   unknown
 test_compile                 !   test_leading_newlines: impl detail; the rest: not good
 test_compiler                !   unknown

Copied: pypy/trunk/lib-python/modified-2.5.2/test/test_coercion.py (from r59521, pypy/trunk/lib-python/2.5.2/test/test_coercion.py)
==============================================================================
--- pypy/trunk/lib-python/2.5.2/test/test_coercion.py	(original)
+++ pypy/trunk/lib-python/modified-2.5.2/test/test_coercion.py	Thu Oct 30 11:01:18 2008
@@ -2,7 +2,7 @@
 import sys
 import warnings
 import unittest
-from test.test_support import run_unittest, TestFailed
+from test.test_support import run_unittest, TestFailed, check_impl_detail
 
 # Fake a number that implements numeric methods through __coerce__
 class CoerceNumber:
@@ -306,11 +306,17 @@
         self.assertNotEquals(cmp(u'fish', evil_coercer), 0)
         self.assertNotEquals(cmp(slice(1), evil_coercer), 0)
         # ...but that this still works
-        class WackyComparer(object):
-            def __cmp__(slf, other):
-                self.assert_(other == 42, 'expected evil_coercer, got %r' % other)
-                return 0
-        self.assertEquals(cmp(WackyComparer(), evil_coercer), 0)
+        if check_impl_detail:
+            # NB. I (arigo) would consider the following as implementation-
+            # specific.  For example, in CPython, if we replace 42 with 42.0
+            # both below and in CoerceTo() above, then the test fails.  This
+            # hints that the behavior is really dependent on some obscure
+            # internal details.
+            class WackyComparer(object):
+                def __cmp__(slf, other):
+                    self.assert_(other == 42, 'expected evil_coercer, got %r' % other)
+                    return 0
+            self.assertEquals(cmp(WackyComparer(), evil_coercer), 0)
         # ...and classic classes too, since that code path is a little different
         class ClassicWackyComparer:
             def __cmp__(slf, other):



More information about the Pypy-commit mailing list