def test_invert_map_list(self): input_dic = {0: [(1, 2), (2, 1)], 1: [(2, 1)], 2: [(1, 3), (2, 1)]} result = invert_map_list(input_dic) self.assertEqual(list(result.keys()), [(1, 2), (2, 1), (1, 3)]) self.assertEqual(result[(1, 2)], [0]) self.assertEqual(result[(2, 1)], [0, 1, 2]) self.assertEqual(result[(1, 3)], [2])
def test_build_individual_individual_transport_with_empty_bin_map(self): ind_workblock = { 0: [(1, 1), (1, 2), (1, 3), (2, 3)], 1: [(0, 3), (1, 3), (1, 4), (1, 5)], 2: [(0, 1), (0, 2), (1, 2), (2, 2)], 3: [(8, 8), (8, 7), (7, 7)] } workblock_ind = invert_map_list(ind_workblock) result = build_individual_individual_transport_map( ind_workblock, workblock_ind, 10) self.assertEqual(result, {0: {0, 1, 2}, 1: {0, 1}, 2: {0, 2}, 3: {3}})
def build_workblock_individual_map(individual_workblock_map_arg): # Blocks to individuals return invert_map_list(individual_workblock_map_arg)
def build_store_individual_map(indiv_store_arg): return invert_map_list(indiv_store_arg)