Commit 26585457 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

testMRP: use OrderableKey to sort list containing None and str.

parent 31af8997
Pipeline #33299 failed with stage
in 0 seconds
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
import unittest import unittest
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.Utils import OrderableKey
from erp5.component.test.testBPMCore import TestBPMMixin from erp5.component.test.testBPMCore import TestBPMMixin
from six.moves import range from six.moves import range
import six import six
...@@ -341,18 +342,18 @@ class TestMRPImplementation(TestMRPMixin): ...@@ -341,18 +342,18 @@ class TestMRPImplementation(TestMRPMixin):
reference = None reference = None
movement_list.append((sm.getTradePhase(), sm.getQuantity(), movement_list.append((sm.getTradePhase(), sm.getQuantity(),
reference, sm.getIndustrialPhaseList())) reference, sm.getIndustrialPhaseList()))
movement_list.sort() movement_list.sort(key=lambda x: [OrderableKey(e) for e in x])
self.assertEqual(movement_list, sorted(( self.assertEqual(movement_list, [
('mrp/manufacturing_step_0', -10.0, None, []),
('mrp/manufacturing_step_0', -30.0, None, []), ('mrp/manufacturing_step_0', -30.0, None, []),
('mrp/manufacturing_step_0', -10.0, None, []),
('mrp/manufacturing_step_0', 10.0, ('mrp/manufacturing_step_0', 10.0,
'pr/mrp/manufacturing_step_0', ['trade_phase/mrp/manufacturing_step_0']), 'pr/mrp/manufacturing_step_0', ['trade_phase/mrp/manufacturing_step_0']),
('mrp/manufacturing_step_1', -40.0, None, []),
('mrp/manufacturing_step_1', -10.0, None, []),
('mrp/manufacturing_step_1', -10.0, ('mrp/manufacturing_step_1', -10.0,
'cr/mrp/manufacturing_step_1', ['trade_phase/mrp/manufacturing_step_0']), 'cr/mrp/manufacturing_step_1', ['trade_phase/mrp/manufacturing_step_0']),
('mrp/manufacturing_step_1', -10.0, None, []),
('mrp/manufacturing_step_1', -40.0, None, []),
('mrp/manufacturing_step_1', 10.0, 'pr', []), ('mrp/manufacturing_step_1', 10.0, 'pr', []),
))) ])
order.confirm() order.confirm()
# Build Manufacturing Order # Build Manufacturing Order
......
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