]> granicus.if.org Git - python/commitdiff
Repair some accidents causing Windows failures:
authorTim Peters <tim.peters@gmail.com>
Thu, 16 Aug 2001 16:56:16 +0000 (16:56 +0000)
committerTim Peters <tim.peters@gmail.com>
Thu, 16 Aug 2001 16:56:16 +0000 (16:56 +0000)
+ test_compare.  While None compares less than anything else, it's not
  always the case that None has the smallest id().
+ test_descr.  The output of %p (pointer) formats varies across platforms.
  In particular, on Windows it doesn't produce a leading "0x".

Lib/test/test_compare.py
Lib/test/test_descr.py

index 1d8b94767230025bba894a8fe15727715c3bfbe0..bc833eacdaac3f179bf415b431edc2f0accefefe 100644 (file)
@@ -45,7 +45,7 @@ def test():
                 else:
                     print "%s != %s" % (a, b)
     # Ensure default comparison compares id() of args
-    L = [None]
+    L = []
     for i in range(10):
         L.insert(len(L)/2, Empty())
     for a in L:
index 51a8a409ead131449440c28613ce5d9f0417173a..69ec66a71b6ba0325492cdecb45748a927ddc696 100644 (file)
@@ -881,8 +881,8 @@ def specials():
     verify(c1 != c2)
     verify(not c1 != c1)
     verify(not c1 == c2)
-    verify(str(c1) == '<C object at 0x%x>' % id(c1))
-    verify(repr(c1) == '<C object at 0x%x>' % id(c1))
+    verify(str(c1).startswith('<C object at '))
+    verify(str(c1) == repr(c1))
     verify(-1 not in c1)
     for i in range(10):
         verify(i in c1)
@@ -902,8 +902,8 @@ def specials():
     verify(d1 != d2)
     verify(not d1 != d1)
     verify(not d1 == d2)
-    verify(str(d1) == '<D object at 0x%x>' % id(d1))
-    verify(repr(d1) == '<D object at 0x%x>' % id(d1))
+    verify(str(d1).startswith('<D object at '))
+    verify(str(d1) == repr(d1))
     verify(-1 not in d1)
     for i in range(10):
         verify(i in d1)