diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-01-21 18:52:02 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-01-21 18:52:02 (GMT) |
commit | 08dabf0a7374540637ee637f1b37b8d3cf96d9bf (patch) | |
tree | f8736e6369521098fd2c9758af40196fdbcf0001 /Lib/test/test_extcall.py | |
parent | 9e9bcda547340a47b5f82d0463f4cdc29bd3b143 (diff) | |
download | cpython-08dabf0a7374540637ee637f1b37b8d3cf96d9bf.zip cpython-08dabf0a7374540637ee637f1b37b8d3cf96d9bf.tar.gz cpython-08dabf0a7374540637ee637f1b37b8d3cf96d9bf.tar.bz2 |
Patch #103344: Sort dicts from extcall for easier comparison with Jython.
Diffstat (limited to 'Lib/test/test_extcall.py')
-rw-r--r-- | Lib/test/test_extcall.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py index b727cc7..10162aa 100644 --- a/Lib/test/test_extcall.py +++ b/Lib/test/test_extcall.py @@ -2,11 +2,19 @@ from test_support import verify, verbose, TestFailed from UserList import UserList import string +def sortdict(d): + keys = d.keys() + keys.sort() + lst = [] + for k in keys: + lst.append("%r: %r" % (k, d[k])) + return "{%s}" % ", ".join(lst) + def f(*a, **k): - print a, k + print a, sortdict(k) def g(x, *y, **z): - print x, y, z + print x, y, sortdict(z) def h(j=1, a=2, h=3): print j, a, h @@ -81,8 +89,8 @@ d = {'a': 1, 'b': 2, 'c': 3} d2 = d.copy() verify(d == d2) g(1, d=4, **d) -print d -print d2 +print sortdict(d) +print sortdict(d2) verify(d == d2, "function call modified dictionary") # what about willful misconduct? @@ -199,6 +207,6 @@ for name in ['za', 'zade', 'zabk', 'zabdv', 'zabdevk']: for kwargs in ['', 'a', 'd', 'ad', 'abde']: kwdict = {} for k in kwargs: kwdict[k] = k + k - print func.func_name, args, kwdict, '->', + print func.func_name, args, sortdict(kwdict), '->', try: apply(func, args, kwdict) except TypeError, err: print err |