def test_parse_loop_with_extra_loop(self): """ Tests the parsing of a file with a loop embedded in another loop. """ expected_results = [ LoopElement("array1", "item", [ VerbatimElement("repeat"), BlankElement(), ReplacementElement("item"), BlankElement(), VerbatimElement("again"), BlankElement(), ReplacementElement("var1"), EolElement(), LoopElement("array2", "item2", [ VerbatimElement("crossing"), BlankElement(), VerbatimElement("fingers"), BlankElement(), ReplacementElement("item2"), EolElement() ]) ]) ] self._test_parse("parser_loop_with_extra_var.txt", expected_results)
def test_parse_loop(self): """ Tests the parsing of a file with simple loops. """ expected_results = [LoopElement("array1", "item", [VerbatimElement("repeat"), BlankElement(), ReplacementElement("item"), BlankElement(), VerbatimElement("again"), EolElement() ] ) ] self._test_parse("parser_loop.txt", expected_results)
def test_parse_loop_with_extra_var(self): """ Tests the parsing of a file with simple string replacements together with a simple loop. """ expected_results = [LoopElement("array1", "item", [VerbatimElement("repeat"), BlankElement(), ReplacementElement("item"), BlankElement(), VerbatimElement("again"), BlankElement(), ReplacementElement("var1"), EolElement() ] ) ] self._test_parse("parser_loop_with_extra_var.txt", expected_results)
def test_parse_simple_replacement(self): """ Tests the parsing of a file with simple string replacements. """ expected_results = [VerbatimElement("hi"), BlankElement(), ReplacementElement("variable1"), EolElement(), VerbatimElement("bye"), EolElement()] self._test_parse("parser_var.txt", expected_results)