vyelanin / aima-python

Automatically exported from code.google.com/p/aima-python
0 stars 0 forks source link

'sorted' from python 2.4 or 2.5 makes test on 'utils.histogram' fail #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1) What steps will reproduce the problem?

$ python2.4 doctests.py -v utils.py

or

$ python2.5 doctests.py -v utils.py

2) What is the expected output? What do you see instead?

Failed example:
    histogram(vals, 1) 
Expected:
    [(200, 3), (110, 2), (160, 2), (220, 1), (100, 1)]
Got:
    [(200, 3), (160, 2), (110, 2), (100, 1), (220, 1)]

3) What version of the product are you using? On what operating system?

* Code from SVN repository.
* Debian GNU/Linux (Sid, up-to-date).

4) Please provide any additional information below.

It looks like python's sorted in 2.4 or 2.5 doesn't work exactly as the one
supplied (but I can't try that because I haven't got 2.3, and on 2.4 it
doesn't work).

I'm sure this is not a bug, but maybe you're interested in having
successful tests also on python >= 2.4.

Sorry for such a useless report, otherwise. :-)

Original issue reported on code.google.com by matteo.a...@gmail.com on 1 Oct 2007 at 2:23

GoogleCodeExporter commented 9 years ago
This is really a bug in the test, not the code.  Both the "Expected" and "Got"
answers are acceptable -- they both give the 3 value first, then the 2 values, 
then
the 1 values.  They differ on how they break ties, which is acceptable.  I 
should
rewrite the test so that it does not depend on breaking ties one way or the 
other.

Original comment by peter.no...@gmail.com on 1 Oct 2007 at 3:40

GoogleCodeExporter commented 9 years ago
Changed the test and the code for histogram to return consistent results across
different Python versions.

Original comment by peter.no...@gmail.com on 25 Nov 2007 at 11:06