[Python-Dev] Std test failures on WIndows: test_compare, test_minidom
Tue, 2 Jan 2001 18:19:14 -0500
> test_compare is broken because the expected-output file has
> bizarre stuff in it like:
> cmp(2, ) = -108
> cmp(2, (2,)) = -116
> cmp(2, None) = -78
> What's up with that?
> My fault. I only ran regrtest.py and not "make test".
Neil, my platform doesn't even *have* a "make": are you saying the test
passes for you when you run regrtest.py? That's what I did.
> I'm not sure why you say bizarre stuff though. Do you object to
> testing that 2 is less than None (something that is not part of the
> language spec)
Only in part. Lang Ref 2.1.3 (Comparisons) says you can compare them, and
guarantees they won't compare equal, but doesn't define it beyond that. If
Python actually says "less", fine, we can test for that, although to
minimize maintenance down the road it would be better to test for no more
than we expect Python to guarantee across releases and implementations
(suppose Jython says 2 is greater than None: that's fine too, and it would
be better if the test suite didn't say Jython was broken).
> or do you think that the results from cmp() should be clamped
> between -1 and 1?
Not that either <wink>; cmp() isn't documented that way.
They're "bizarre" simply because they're not what Python returns!
Python 2.0 (#8, Dec 17 2000, 01:39:08) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> cmp(2, )
>>> cmp(2, (2,))
>>> cmp(2, None)
The expected-output file is supposed to match what Python actually does. I
have no idea where things like "-108" came from. So things like -108 look
bizarre to me. So long as cmp(2, ) returns -1 in reality, an
expected-output file that claims it returns -108 will never work no matter
how you run the tests.
One of us is missing something obvious here <wink>.