Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#7303 closed (fixed)

tests/regressiontests/utils/datastructures.py: builtin dict ordering is assumed

Reported by: Leo Soto M. Owned by: nobody
Component: Uncategorized Version: dev
Severity: Keywords: jython
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

At the end of the doctest it says:

>>> real_dict.values()
 ['one', 'second-two']

Which fails on Jython because dict values have not the same ordering as in CPython.

Attached is a simple patch which uses ordered() to keep the check for dict contents without assuming a default ordering.

Attachments (2)

avoid_checking_for_builtin_dict_order.patch (589 bytes ) - added by Leo Soto M. 16 years ago.
avoid_checking_for_builtin_dict_order.2.patch (606 bytes ) - added by Leo Soto M. 16 years ago.
new version, doesn't use sorted

Download all attachments as: .zip

Change History (6)

comment:1 by Alex Gaynor, 16 years ago

sorted() is a python2.5 function so this needs to do the inplace sort and then show the result.

by Leo Soto M., 16 years ago

new version, doesn't use sorted

comment:2 by Leo Soto M., 16 years ago

Right, sorted() is not present on python2.3. I just uploaded a new patch.

comment:3 by Russell Keith-Magee, 16 years ago

Resolution: fixed
Status: newclosed

(In [7890]) Fixed #7303 -- Clarified a test case that was dependent on dict ordering. Thanks to leosoto for the patch.

comment:4 by Russell Keith-Magee, 16 years ago

Regarding the sorted() issue - there are many other instances where sorted() is used; I've opened ticket #7718 to make sure they get fixed.

Note: See TracTickets for help on using tickets.
Back to Top