Message7549
Test test_dict.py passed when using Java 7 - I tried Oracle's and IBM's.
However, when I use Java 8, it fails.
I believe test_dict.py is not a good test because it assumes that 2 adjacent dicts (hashes) will, if populated with the same key/value pairs in the same order, return those values in the same order.
For example, populating both dict_a and dict_b with values 3, 1, 2, 7, 6, 5, 4, and 0, using the value as the key (i.e. key=value in each tuple), it assumes that both dict_a and dict_b will both be the same.
I observed that this is the case when using Java 7 - both dicts are the same.
I also observed that using Python instead of Jython, not only are both dicts the same, but they are both ordered in ascending key sequence.
However, they are not the same with Java 8, as illustrated by one set of results I saw:
dict_a {3: 3, 6: 6, 0: 0, 4: 4, 1: 1, 5: 5, 2: 2, 7: 7}
dict_b {5: 5, 6: 6, 3: 3, 2: 2, 1: 1, 7: 7, 4: 4, 0: 0}
It is my understanding that a dict is a hash, and that the order of hashes is not specified and should not be assumed.
The fact that test_dict.py makes an assumption about the ordering means that it is not a reliable test and should be removed. |
|
Date |
User |
Action |
Args |
2012-12-21 07:49:35 | geraint | set | recipients:
+ geraint |
2012-12-21 07:49:35 | geraint | set | messageid: <1356076175.41.0.219122259504.issue1998@psf.upfronthosting.co.za> |
2012-12-21 07:49:35 | geraint | link | issue1998 messages |
2012-12-21 07:49:34 | geraint | create | |
|