[pypy-svn] r68747 - pypy/trunk/lib-python/modified-2.5.2/test

arigo at codespeak.net arigo at codespeak.net
Mon Oct 26 11:43:56 CET 2009


Author: arigo
Date: Mon Oct 26 11:43:55 2009
New Revision: 68747

Added:
   pypy/trunk/lib-python/modified-2.5.2/test/test_strptime.py
      - copied, changed from r68734, pypy/trunk/lib-python/2.5.2/test/test_strptime.py
Log:
Bogus usage of id() in a test.  Failed once on pypy-c because
the old object was dead, and the id() returned for the new
object was the same integer, completely by chance.


Copied: pypy/trunk/lib-python/modified-2.5.2/test/test_strptime.py (from r68734, pypy/trunk/lib-python/2.5.2/test/test_strptime.py)
==============================================================================
--- pypy/trunk/lib-python/2.5.2/test/test_strptime.py	(original)
+++ pypy/trunk/lib-python/modified-2.5.2/test/test_strptime.py	Mon Oct 26 11:43:55 2009
@@ -523,16 +523,16 @@
             return
         try:
             _strptime.strptime('10', '%d')
-            # Get id of current cache object.
-            first_time_re_id = id(_strptime._TimeRE_cache)
+            # Get the current cache object.
+            first_time_re = _strptime._TimeRE_cache
             try:
                 # Change the locale and force a recreation of the cache.
                 locale.setlocale(locale.LC_TIME, ('de_DE', 'UTF8'))
                 _strptime.strptime('10', '%d')
-                # Get the new cache object's id.
-                second_time_re_id = id(_strptime._TimeRE_cache)
-                # They should not be equal.
-                self.failIfEqual(first_time_re_id, second_time_re_id)
+                # Get the new cache object.
+                second_time_re = _strptime._TimeRE_cache
+                # They should not be identical.
+                self.assert_(first_time_re is not second_time_re)
             # Possible test locale is not supported while initial locale is.
             # If this is the case just suppress the exception and fall-through
             # to the reseting to the original locale.



More information about the Pypy-commit mailing list