def make_repl(): """ Make a REPL with some useful definitions for testing. """ r = REPL() r.run_lines([ r'=a.\x.y', r'=b.\x.y', r'=c.\x.y', r'=d.\x.y', ]) return r
buf_out.write(value) buf_out.write('\n') return value def o(value): buf_out.write(str(value)) buf_out.write('\n') def result(): return buf_out.getvalue() return i, o, result if __name__ == '__main__': prepared_input = [] for ls, c in INPUT: prepared_input.extend(prepare_input(ls, c)) i, o, result = make_io_pair(prepared_input) set_extra_info(o) r = REPL() r.run(i=i, o=o) for line in result().splitlines(): print(' ' + line)