Message11675
So I think I have understood and fixed this problem. The issue is when comparing Python {list, set, map} with Java {List, Set, Map} using the not equal (!=) operation. Here are examples of all of them failing:
Jython 2.7.1 (, Nov 22 2017, 17:47:15)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_144
Type "help", "copyright", "credits" or "license" for more information.
>>> from java.util import ArrayList
>>> al = ArrayList([1,2,3])
>>> al == [1,2,3]
True
>>> al != [1,2,3]
True <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Wrong
>>> from java.util import HashSet
>>> hs = HashSet([1,2,3])
>>> hs == set([1,2,3])
True
>>> hs != set([1,2,3])
True <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Wrong
>>> from java.util import HashMap
hm = HashMap({'a': 1, 'b': 2, 'c': 3})
>>> hm
{a: 1, b: 2, c: 3}
>>> hm == {'a': 1, 'b': 2, 'c': 3}
True
>>> hm != {'a': 1, 'b': 2, 'c': 3}
True <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Wrong
I have changed the issue title to better describe this behaviour. I belive the issue is with JavaProxy{List, Set, Map} where the __ne__ function is not defined. I have written additional tests to cover these cases and expanded the test coverage to more types of Java {List, Set, Map} while doing this I have noticed two another issues see #2644 and #2645
I now have a pull request which I think fixes this in a nice way. https://github.com/jythontools/jython/pull/96 Would appreciate someone else having a look over it.
Hopefully this can make it in before 2.7.2! |
|
Date |
User |
Action |
Args |
2017-11-22 19:25:55 | jamesmudd | set | messageid: <1511378755.16.0.213398074469.issue2639@psf.upfronthosting.co.za> |
2017-11-22 19:25:55 | jamesmudd | set | recipients:
+ jamesmudd, Amjad |
2017-11-22 19:25:55 | jamesmudd | link | issue2639 messages |
2017-11-22 19:25:54 | jamesmudd | create | |
|