diff options
Diffstat (limited to 'Lib/test/test_b1.py')
-rw-r--r-- | Lib/test/test_b1.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_b1.py b/Lib/test/test_b1.py index 6a89d2209a..b063e5aa71 100644 --- a/Lib/test/test_b1.py +++ b/Lib/test/test_b1.py @@ -63,6 +63,15 @@ print 'cmp' if cmp(-1, 1) <> -1: raise TestFailed, 'cmp(-1, 1)' if cmp(1, -1) <> 1: raise TestFailed, 'cmp(1, -1)' if cmp(1, 1) <> 0: raise TestFailed, 'cmp(1, 1)' +# verify that circular objects are handled +a = []; a.append(a) +b = []; b.append(b) +from UserList import UserList +c = UserList(); c.append(c) +if cmp(a, b) != 0: raise TestFailed, "cmp(%s, %s)" % (a, b) +if cmp(b, c) != 0: raise TestFailed, "cmp(%s, %s)" % (b, c) +if cmp(c, a) != 0: raise TestFailed, "cmp(%s, %s)" % (c, a) +if cmp(a, c) != 0: raise TestFailed, "cmp(%s, %s)" % (a, c) print 'coerce' if fcmp(coerce(1, 1.1), (1.0, 1.1)): raise TestFailed, 'coerce(1, 1.1)' |