def test_group_objects(self): """ Test going from basic information to group objects """ groups = group_objects(self.days, num_groups=3, size_of_groups=3) nose.tools.assert_equal(len(groups), 12) for d in self.days: groups_that_day = [g for g in groups if g.day == d] nose.tools.assert_equal(len(groups_that_day), 3) for g in groups: nose.tools.assert_equal(g.people, []) nose.tools.assert_equal(g.capacity, 3) nose.tools.assert_true(hasattr(g,'name')) days_out = days_from_groups(groups) nose.tools.assert_equal(set(self.days), set(days_out))
def __init__(self, solution): self.solution = solution self.days = days_from_groups(self.solution) self.update_solution_metrics()