def test_variation_can_be_framed_and_save(self): for variation in self.variations: framed = varexercise.frame(variation.one(1)) with open('temp.tex', "w") as f: f.writelines(framed) with open('temp.tex', "r") as f: text = f.read() self.assertIn('\\documentclass', text) self.assertIn('\\begin{document}', text)
def save_file(text, parameters, file_name, is_4a5=False): framed_text = varexercise.frame( text, **parameters ) output_tex_files.append(file_name, is_4a5) if options.verbose > 0: message(_('I\'ve opened the file "%s".\n') % file_name) with open(file_name, 'w') as f: f.writelines(framed_text)
def _make_testpapers_test(): """ It tests varexercise.Variations.""" print(files.input) global exercise_numbers number_of_variations = 1 v = varexercise.Variations( exercise_numbers, files.input, number_of_variations ) text = v.one(1) text = varexercise.frame(text) print(text)