Commit 92cbee68 authored by Julien Muchembled's avatar Julien Muchembled

simulation: specialise tester must not sort before comparing decision and prevision

The order of specialise categories is important.
parent e5792f39
......@@ -59,7 +59,7 @@ class CategoryMembershipEquivalenceTester(Predicate, EquivalenceTesterMixin):
# What about using getCategoryMembershipList for Simulation Movements ?
return movement.getAcquiredCategoryMembershipList(property)
def _compare(self, prevision_movement, decision_movement):
def _compare(self, prevision_movement, decision_movement, sorted=sorted):
"""
If prevision_movement and decision_movement don't match, it returns a
list : (prevision_value, decision_value, message, mapping)
......@@ -68,11 +68,6 @@ class CategoryMembershipEquivalenceTester(Predicate, EquivalenceTesterMixin):
if getattr(decision_movement, 'isPropertyRecorded',
lambda x:False)(tested_property):
decision_value = decision_movement.getRecordedProperty(tested_property)
if not isinstance(decision_value, (list, tuple)):
if decision_value is None:
decision_value = []
else:
decision_value = [decision_value]
else:
decision_value = self._getTestedPropertyValue(decision_movement,
tested_property)
......
......@@ -43,6 +43,10 @@ class SpecialiseEquivalenceTester(CategoryMembershipEquivalenceTester):
movement_specialise_type = ()
movement_exclude_specialise_type = ()
def _compare(self, prevision_movement, decision_movement, sorted=lambda x:x):
return super(SpecialiseEquivalenceTester, self)._compare(
prevision_movement, decision_movement, sorted)
def _getTestedPropertyValue(self, movement, property):
if movement.getPortalType() == 'Simulation Movement':
return movement.getCategoryMembershipList(property)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment