def test_illegal_syntax(self): # missing arguments with nostderrout(): error = textfill( input='../../gslab_fill/tests/input/legal.log', template='../../gslab_fill/tests/input/textfill_template.lyx') self.assertIn('KeyError', error) # non-existent input 1 with nostderrout(): error = textfill( input='../../gslab_fill/tests/input/fake_file.log', template='../../gslab_fill/tests/input/textfill_template.lyx', output='./build/textfill_template_filled.lyx') self.assertIn('IOError', error) # non-existent input 2 with nostderrout(): error = textfill( input='./log/stata.log ./input/fake_file.log', template='../../gslab_fill/tests/input/textfill_template.lyx', output='./build/textfill_template_filled.lyx') self.assertIn('IOError', error)
def test_remove_echoes(self): with nostderrout(): textfill(input = '../../gslab_fill/tests/input/legal.log', template = '../../gslab_fill/tests/input/textfill_template.lyx', output = './build/textfill_template_filled.lyx', remove_echoes = True) log_remove_string = '. ' log = '../../gslab_fill/tests/input/legal.log' self.check_log_in_LyX(log, log_remove_string, "textfill_")
def test_tags_incorrectly_specified(self): with nostderrout(): textfill(input = '../../gslab_fill/tests/input/tags_incorrectly_named.log', template = '../../gslab_fill/tests/input/textfill_template.lyx', output = './build/textfill_template_filled.lyx') log_remove_string = '. insert_tag' with self.assertRaises(AssertionError): log = '../../gslab_fill/tests/input/tags_incorrectly_named.log' self.check_log_in_LyX(log, log_remove_string, "textfill_")
def test_argument_order(self): with nostderrout(): message = textfill(input = '../../gslab_fill/tests/input/legal.log', output = '../../gslab_fill/tests/input/textfill_template_filled.lyx', template = '../../gslab_fill/tests/input/textfill_template.lyx') self.assertIn('filled successfully', message) with nostderrout(): message = textfill(template = '../../gslab_fill/tests/input/textfill_template.lyx', output = './build/textfill_template_filled.lyx', input = '../../gslab_fill/tests/input/legal.log') self.assertIn('filled successfully', message)
def test_tags_not_closed(self): with nostderrout(): error = textfill( input='../../gslab_fill/tests/input/tags_not_closed.log', template='../../gslab_fill/tests/input/textfill_template.lyx', output='./build/textfill_template_filled.lyx') self.assertIn('HTMLParseError', error)
def test_tags_dont_match(self): with nostderrout(): error = textfill( input='../../gslab_fill/tests/input/tags_dont_match.log', template='../../gslab_fill/tests/input/textfill_template.lyx', output='./build/textfill_template_filled.lyx') self.assertIn('ValueError', error)
def test_input(self): with nostderrout(): message = textfill(input = '../../gslab_fill/tests/input/legal.log', template = '../../gslab_fill/tests/input/textfill_template.lyx', output = './build/textfill_template_filled.lyx') self.assertIn('filled successfully', message) log_remove_string = '. insert_tag' log = '../../gslab_fill/tests/input/legal.log' self.check_log_in_LyX(log, log_remove_string, "textfill_")