-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not print dictionaries in test output #1
base: master
Are you sure you want to change the base?
Conversation
Order of keys in the dictionary is not reliable. The order is pseudo-random under Python 3. Tests still pass under Python 2.
I was working on a package for Fedora (https://bugzilla.redhat.com/show_bug.cgi?id=1310145), and wanted the tests to pass under both Python 2 and 3. This patch removes a broken assumption from the tests. Unfortunately for the tests to pass under Python 3, much more extensive changes are required. I made such changes in neurord/igor@ba8f001ed9. But those changes work only for Python 3, and obviously break things for Python 2, so I'm not submitting them in this pull request. |
On Mon, Feb 29, 2016 at 05:59:17AM -0800, Zbigniew Jędrzejewski-Szmek wrote:
I think dictionary keys are sorted by key for pprint functions since $ python3 -c "import pprint; pprint.pprint({u'a': 1, b'b': 2})" But in Python 2 bytes and Unicode are interleaved: $ python2 -c "import pprint; pprint.pprint({u'a': 1, b'b': 2})" Running the tests under Python 3, most of the changes I see are things |
You're right, the issue is with I'm wondering if the right solution might be to decode the keys to |
On Tue, Mar 01, 2016 at 12:43:02PM -0800, Zbigniew Jędrzejewski-Szmek wrote:
I haven't looked at the Igor specs in a while, so I'm not sure what However, if we can decode to Unicode, we'd get u'…' prefixes in Python |
I don't think they'd need to be decoded in Python 2... I have never seen any keys other than ASCII. So they could be decoded in Python 3, even as ASCII, and it would be enough. I'll look at the specs if there's anything about the encoding. |
TN003 does not say anything about encodings, and the code is encoding unaware afaict.
This implies that igor binary files must be ASCII-only. So using |
On Mon, Mar 07, 2016 at 11:05:07AM -0800, Zbigniew Jędrzejewski-Szmek wrote:
Thanks for looking up the docs. And I agree that “ASCII-only” seems I'm less convinced that using the byte type (‘str’) in Python 2 and |
I haven't actually tested all of these, but I doubt I did anything so magical that support has been dropped in the meantime ;). It would be nice to drop the doctests [1], but until then testing Python 3 is going to be difficult. [1]: #1 (comment)
Order of keys in the dictionary is not reliable. The order is
pseudo-random under Python 3.
Tests still pass under Python 2.