def __init__(self, problem_list, **kwargs): if isinstance(problem_list, Problem): problem_list = [problem_list] super(Exam, self).__init__(stack(problem_list))
def test_stack(self): self.assertEqual( stack(['patate', 'poil']), 'patate\npoil') a = Block('patate') b = Block('poil') self.assertEqual(stack([a,b]), 'patate\npoil')
def formated_content(self): if hasattr(self.content, '__iter__'): return stack(self.content) return self.content
def __init__(self, content=None, nb_compile_times=1): if content is not None: self.content = content if hasattr(self.content, '__iter__'): self.content = stack(self.content) self.nb_compile_times = nb_compile_times