From eb7b727b15f14ca364851f076e24d579d54422b2 Mon Sep 17 00:00:00 2001 From: "Ben F. Maier" Date: Sat, 3 Jul 2021 23:33:52 +0200 Subject: [PATCH] maybe fixed test --- binpacking/tests/constant_bin_number.py | 13 +++++++++++-- binpacking/tests/constant_volume.py | 19 ++++++++++++++++--- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/binpacking/tests/constant_bin_number.py b/binpacking/tests/constant_bin_number.py index e7f934b..cc2d8f5 100644 --- a/binpacking/tests/constant_bin_number.py +++ b/binpacking/tests/constant_bin_number.py @@ -36,22 +36,31 @@ def test_bounds_and_tuples(): N_bin = 4 bins = to_constant_bin_number(c,N_bin,weight_pos=1,upper_bound=11) + bins = [ sorted(_bin, key=lambda x:x[0]) for _bin in bins ] assert bins == [ [('a', 10, 'foo')], [('b', 10, 'log')], [('f', 7, 'floggo')], - [('e', 2, 'bommel'), ('d', 1, 'bar')] + [ + ('d', 1, 'bar'), + ('e', 2, 'bommel'), + ] ] bins = to_constant_bin_number(c,N_bin,weight_pos=1,lower_bound=1) + bins = [ sorted(_bin, key=lambda x:x[0]) for _bin in bins ] assert bins == [ [('c', 11,)], [('a', 10, 'foo')], [('b', 10, 'log')], - [('f', 7, 'floggo'), ('e', 2, 'bommel')], + [ + ('e', 2, 'bommel'), + ('f', 7, 'floggo'), + ], ] bins = to_constant_bin_number(c,N_bin,weight_pos=1,lower_bound=1,upper_bound=11) + bins = [ sorted(_bin, key=lambda x:x[0]) for _bin in bins ] assert bins == [ [('a', 10, 'foo')], [('b', 10, 'log')], diff --git a/binpacking/tests/constant_volume.py b/binpacking/tests/constant_volume.py index 16659de..ad0d5d6 100644 --- a/binpacking/tests/constant_volume.py +++ b/binpacking/tests/constant_volume.py @@ -42,24 +42,37 @@ def test_bounds_and_tuples(): V_max = 11 bins = to_constant_volume(c,V_max,weight_pos=1,upper_bound=11) + bins = [ sorted(_bin, key=lambda x:x[0]) for _bin in bins ] assert bins == [ [('a', 10, 'foo'), ('d', 1, 'bar')], - [('b', 10, 'log')], [('f', 7, 'floggo'), ('e', 2, 'bommel')], + [('b', 10, 'log')], + [ + ('e', 2, 'bommel'), + ('f', 7, 'floggo'), + ], ] bins = to_constant_volume(c,V_max,weight_pos=1,lower_bound=1) + bins = [ sorted(_bin, key=lambda x:x[0]) for _bin in bins ] assert bins == [ [('c', 11,)], [('a', 10, 'foo')], [('b', 10, 'log')], - [('f', 7, 'floggo'), ('e', 2, 'bommel')], + [ + ('e', 2, 'bommel'), + ('f', 7, 'floggo'), + ], ] bins = to_constant_volume(c,V_max,weight_pos=1,lower_bound=1,upper_bound=11) + bins = [ sorted(_bin, key=lambda x:x[0]) for _bin in bins ] assert bins == [ [('a', 10, 'foo')], [('b', 10, 'log')], - [('f', 7, 'floggo'), ('e', 2, 'bommel')], + [ + ('e', 2, 'bommel'), + ('f', 7, 'floggo'), + ], ]