Beispiel #1
0
 def test_max_spare_cap_few(self):
     h = rb.MaxSpareCapacity(self.bins[:4])
     expected = [[8], [5, 2, 1], [7], [6, 4]]
     misfits = []
     self.assertEqual(len(self.items) - len(misfits), h.binpack(self.items))
     did_part = [bin.items for bin in h.bins]
     self.assertEqual(expected, did_part)
     self.assertEqual(misfits, h.misfits)
Beispiel #2
0
 def test_max_spare_cap_small(self):
     h = rb.MaxSpareCapacity(make_bin=lambda: self.make_bin(7))
     expected = [[5, 2], [7], [6], [4, 1]]
     misfits = [8]
     self.assertEqual(len(self.items) - len(misfits), h.binpack(self.items))
     did_part = [bin.items for bin in h.bins]
     self.assertEqual(expected, did_part)
     self.assertEqual(misfits, h.misfits)
Beispiel #3
0
 def test_max_spare_cap_make(self):
     h = rb.MaxSpareCapacity(make_bin=lambda: self.make_bin(10))
     self.assertEqual(len(self.items), h.binpack(self.items))
     expected = [[8], [5, 2, 1], [7], [6, 4]]
     did_part = [bin.items for bin in h.bins]
     self.assertEqual(expected, did_part)
Beispiel #4
0
 def test_max_spare_cap_fixed(self):
     h = rb.MaxSpareCapacity(self.bins)
     self.assertEqual(len(self.items), h.binpack(self.items))
     expected = [[8], [5, 1], [7], [6], [2, 4]]
     did_part = [bin.items for bin in h.bins]
     self.assertEqual(expected, did_part)