Hello,
I am migrating from Capella 1.4.2 to Capella 6.1 and I am getting different API behavior when comparing two Capella elements or when traversing lists (JavaList).
I would have difficulty explaining the problem in English, so I suggest you look at the following code instead:
I made the test on my side (Capella 7.0.0, Python for Capella 1.3.0 and Python 3.11) and get the following result:
LC1 = <__main__.SystemEngineering object at 0x7e57ba6326d0>
LC2 = <__main__.SystemEngineering object at 0x7e57ba633790>
LC1 is LC2: False
LC1 == LC2: True
LC1 in [ LC2 ]: True
jo_LC1 = org.polarsys.capella.core.data.capellamodeller.impl.SystemEngineeringImpl@1a75c337 (id: 8f49452e-61f2-4ba0-b944-352d1f4c4227, sid: null) (name: In-Flight Entertainment System) (visibleInDoc: true, visibleInLM: true, summary: null, review: null)
jo_LC2 = org.polarsys.capella.core.data.capellamodeller.impl.SystemEngineeringImpl@1a75c337 (id: 8f49452e-61f2-4ba0-b944-352d1f4c4227, sid: null) (name: In-Flight Entertainment System) (visibleInDoc: true, visibleInLM: true, summary: null, review: null)
jo_LC1 is jo_LC2: True
jo_LC1 == jo_LC2: True
jo_LC1 in [ jo_LC2 ]: True
Which is correct. The operator is in Python is the identity comparison aka the same object in memory, that’s why it return False while the == operator return True by delegating to __eq__() and Java equals() method.
OK, you probably need to update to Python for Capella 1.3.0 then. You can also apply the change on Python for Capella 1.2.0 and test if it fix the problem.