def test_invert_map(self):
     input_dic = {0: 1, 1: 1, 2: 2}
     result = invert_map(input_dic)
     self.assertEqual(list(result.keys()), [1, 2])
     self.assertEqual(result[1], [0, 1])
     self.assertEqual(result[2], [2])
def build_house_individual_map(individual_house_map_arg):
    # House -> List of individuals
    return invert_map(individual_house_map_arg)
def build_workplace_individual_map(individual_workplace_map_arg):
    # workplace -> Individuals
    return invert_map(individual_workplace_map_arg)
Ejemplo n.º 4
0
 def test_build_individual_houses_map__average_moroccan_household(self):
     result = build_individual_houses_map(1000)
     mean_family = np.mean([len(v) for k, v in invert_map(result).items()])
     self.assertTrue(abs(mean_family - 4.52) < 0.3)