def test_nested(self): model = get_model('''\ *** Test Cases *** Example IF ${x} IF ${y} K1 ELSE IF ${z} K2 ''', data_only=True) node = model.sections[0].body[0].body[0] expected = If( header=InlineIfHeader([Token(Token.INLINE_IF, 'IF', 3, 4), Token(Token.ARGUMENT, '${x}', 3, 10)]), body=[If( header=InlineIfHeader([Token(Token.INLINE_IF, 'IF', 3, 18), Token(Token.ARGUMENT, '${y}', 3, 24)]), body=[KeywordCall([Token(Token.KEYWORD, 'K1', 3, 32)])], orelse=If( header=ElseHeader([Token(Token.ELSE, 'ELSE', 3, 38)]), body=[If( header=InlineIfHeader([Token(Token.INLINE_IF, 'IF', 3, 46), Token(Token.ARGUMENT, '${z}', 3, 52)]), body=[KeywordCall([Token(Token.KEYWORD, 'K2', 3, 60)])], end=End([Token(Token.END, '', 3, 62)]), )], ), errors=('Inline IF cannot be nested.',), )], errors=('Inline IF cannot be nested.',), ) assert_model(node, expected)
def test_if_else_if_else(self): data = ''' *** Test Cases *** Example IF True K1 ELSE IF False K2 ELSE K3 END ''' expected = If( header=IfHeader([ Token(Token.IF, 'IF', 3, 4), Token(Token.ARGUMENT, 'True', 3, 10), ]), body=[KeywordCall([Token(Token.KEYWORD, 'K1', 4, 8)])], orelse=If( header=ElseIfHeader([ Token(Token.ELSE_IF, 'ELSE IF', 5, 4), Token(Token.ARGUMENT, 'False', 5, 15), ]), body=[KeywordCall([Token(Token.KEYWORD, 'K2', 6, 8)])], orelse=If( header=ElseHeader([ Token(Token.ELSE, 'ELSE', 7, 4), ]), body=[KeywordCall([Token(Token.KEYWORD, 'K3', 8, 8)])], )), end=End([Token(Token.END, 'END', 9, 4)])) get_and_assert_model(data, expected)
def test_if_else_if_else(self): model = get_model('''\ *** Test Cases *** Example IF True K1 ELSE IF False K2 ELSE K3 END ''', data_only=True) node = model.sections[0].body[0].body[0] expected = If( header=IfHeader([ Token(Token.IF, 'IF', 3, 4), Token(Token.ARGUMENT, 'True', 3, 10), ]), body=[KeywordCall([Token(Token.KEYWORD, 'K1', 4, 8)])], orelse=If( header=ElseIfHeader([ Token(Token.ELSE_IF, 'ELSE IF', 5, 4), Token(Token.ARGUMENT, 'False', 5, 15), ]), body=[KeywordCall([Token(Token.KEYWORD, 'K2', 6, 8)])], orelse=If( header=ElseHeader([ Token(Token.ELSE, 'ELSE', 7, 4), ]), body=[KeywordCall([Token(Token.KEYWORD, 'K3', 8, 8)])], )), end=End([Token(Token.END, 'END', 9, 4)])) assert_model(node, expected)
def test_nested(self): model = get_model('''\ *** Test Cases *** Example IF ${x} Log ${x} IF ${y} Log ${y} ELSE Log ${z} END END ''', data_only=True) node = model.sections[0].body[0].body[0] expected = If( header=IfHeader([ Token(Token.IF, 'IF', 3, 4), Token(Token.ARGUMENT, '${x}', 3, 10), ]), body=[ KeywordCall([Token(Token.KEYWORD, 'Log', 4, 8), Token(Token.ARGUMENT, '${x}', 4, 15)]), If( header=IfHeader([ Token(Token.IF, 'IF', 5, 8), Token(Token.ARGUMENT, '${y}', 5, 14), ]), body=[ KeywordCall([Token(Token.KEYWORD, 'Log', 6, 12), Token(Token.ARGUMENT, '${y}', 6, 19)]) ], orelse=If( header=ElseHeader([ Token(Token.ELSE, 'ELSE', 7, 8) ]), body=[ KeywordCall([Token(Token.KEYWORD, 'Log', 8, 12), Token(Token.ARGUMENT, '${z}', 8, 19)]) ] ), end=End([ Token(Token.END, 'END', 9, 8) ]) ) ], end=End([ Token(Token.END, 'END', 10, 4) ]) ) assert_model(node, expected)
def test_nested(self): data = ''' *** Test Cases *** Example FOR ${x} IN 1 2 FOR ${y} IN RANGE ${x} Log ${y} END END ''' expected = For(header=ForHeader([ Token(Token.FOR, 'FOR', 3, 4), Token(Token.VARIABLE, '${x}', 3, 11), Token(Token.FOR_SEPARATOR, 'IN', 3, 19), Token(Token.ARGUMENT, '1', 3, 25), Token(Token.ARGUMENT, '2', 3, 30), ]), body=[ For(header=ForHeader([ Token(Token.FOR, 'FOR', 4, 8), Token(Token.VARIABLE, '${y}', 4, 15), Token(Token.FOR_SEPARATOR, 'IN RANGE', 4, 23), Token(Token.ARGUMENT, '${x}', 4, 35), ]), body=[ KeywordCall([ Token(Token.KEYWORD, 'Log', 5, 12), Token(Token.ARGUMENT, '${y}', 5, 19) ]) ], end=End([Token(Token.END, 'END', 6, 8)])) ], end=End([Token(Token.END, 'END', 7, 4)])) get_and_assert_model(data, expected)
def test_break(self): model = get_model('''\ *** Keywords *** Name WHILE True Break BREAK BREAK END ''', data_only=True) expected = KeywordSection( header=SectionHeader( tokens=[Token(Token.KEYWORD_HEADER, '*** Keywords ***', 1, 0) ]), body=[ Keyword( header=KeywordName( tokens=[Token(Token.KEYWORD_NAME, 'Name', 2, 0)]), body=[ While(header=WhileHeader([ Token(Token.WHILE, 'WHILE', 3, 4), Token(Token.ARGUMENT, 'True', 3, 13) ]), body=[ KeywordCall([ Token(Token.KEYWORD, 'Break', 4, 8), Token(Token.ARGUMENT, 'BREAK', 4, 17) ]), Break([Token(Token.BREAK, 'BREAK', 5, 8)]) ], end=End([Token(Token.END, 'END', 6, 4)])) ], ) ]) assert_model(model.sections[0], expected)
def test_return(self): model = get_model('''\ *** Keywords *** Name Return RETURN RETURN RETURN ''', data_only=True) expected = KeywordSection( header=SectionHeader( tokens=[Token(Token.KEYWORD_HEADER, '*** Keywords ***', 1, 0) ]), body=[ Keyword( header=KeywordName( tokens=[Token(Token.KEYWORD_NAME, 'Name', 2, 0)]), body=[ KeywordCall([ Token(Token.KEYWORD, 'Return', 3, 4), Token(Token.ARGUMENT, 'RETURN', 3, 14) ]), ReturnStatement([ Token(Token.RETURN_STATEMENT, 'RETURN', 4, 4), Token(Token.ARGUMENT, 'RETURN', 4, 14) ]) ], ) ]) assert_model(model.sections[0], expected)
def test_continue(self): model = get_model('''\ *** Keywords *** Name FOR ${x} IN @{stuff} Continue CONTINUE CONTINUE END ''', data_only=True) expected = KeywordSection( header=SectionHeader( tokens=[Token(Token.KEYWORD_HEADER, '*** Keywords ***', 1, 0)] ), body=[ Keyword( header=KeywordName( tokens=[Token(Token.KEYWORD_NAME, 'Name', 2, 0)] ), body=[ For( header=ForHeader([Token(Token.FOR, 'FOR', 3, 4), Token(Token.VARIABLE, '${x}', 3, 11), Token(Token.FOR_SEPARATOR, 'IN', 3, 19), Token(Token.ARGUMENT, '@{stuff}', 3, 25)]), body=[KeywordCall([Token(Token.KEYWORD, 'Continue', 4, 8), Token(Token.ARGUMENT, 'CONTINUE', 4, 20)]), Continue([Token(Token.CONTINUE, 'CONTINUE', 5, 8)])], end=End([Token(Token.END, 'END', 6, 4)]) ) ], ) ] ) assert_model(model.sections[0], expected)
def test_valid(self): model = get_model('''\ *** Test Cases *** Example FOR ${x} IN a b c Log ${x} END ''', data_only=True) loop = model.sections[0].body[0].body[0] expected = ForLoop(header=ForLoopHeader([ Token(Token.FOR, 'FOR', 3, 4), Token(Token.VARIABLE, '${x}', 3, 11), Token(Token.FOR_SEPARATOR, 'IN', 3, 19), Token(Token.ARGUMENT, 'a', 3, 25), Token(Token.ARGUMENT, 'b', 3, 30), Token(Token.ARGUMENT, 'c', 3, 35), ]), body=[ KeywordCall([ Token(Token.KEYWORD, 'Log', 4, 8), Token(Token.ARGUMENT, '${x}', 4, 15) ]) ], end=End([Token(Token.END, 'END', 5, 4)])) assert_model(loop, expected)
def test_nested(self): data = ''' *** Test Cases *** Example IF ${x} Log ${x} IF ${y} Log ${y} ELSE Log ${z} END END ''' expected = If(header=IfHeader([ Token(Token.IF, 'IF', 3, 4), Token(Token.ARGUMENT, '${x}', 3, 10), ]), body=[ KeywordCall([ Token(Token.KEYWORD, 'Log', 4, 8), Token(Token.ARGUMENT, '${x}', 4, 15) ]), If(header=IfHeader([ Token(Token.IF, 'IF', 5, 8), Token(Token.ARGUMENT, '${y}', 5, 14), ]), body=[ KeywordCall([ Token(Token.KEYWORD, 'Log', 6, 12), Token(Token.ARGUMENT, '${y}', 6, 19) ]) ], orelse=If(header=ElseHeader( [Token(Token.ELSE, 'ELSE', 7, 8)]), body=[ KeywordCall([ Token(Token.KEYWORD, 'Log', 8, 12), Token(Token.ARGUMENT, '${z}', 8, 19) ]) ]), end=End([Token(Token.END, 'END', 9, 8)])) ], end=End([Token(Token.END, 'END', 10, 4)])) get_and_assert_model(data, expected)
def test_assign(self): data = ''' *** Test Cases *** Example ${x} = IF True K1 ELSE K2 ''' expected = If( header=InlineIfHeader([ Token(Token.ASSIGN, '${x} =', 3, 4), Token(Token.INLINE_IF, 'IF', 3, 14), Token(Token.ARGUMENT, 'True', 3, 20) ]), body=[KeywordCall([Token(Token.KEYWORD, 'K1', 3, 28)])], orelse=If( header=ElseHeader([Token(Token.ELSE, 'ELSE', 3, 34)]), body=[KeywordCall([Token(Token.KEYWORD, 'K2', 3, 42)])], ), end=End([Token(Token.END, '', 3, 44)])) get_and_assert_model(data, expected)
def test_assign(self): model = get_model('''\ *** Test Cases *** Example ${x} = IF True K1 ELSE K2 ''', data_only=True) node = model.sections[0].body[0].body[0] expected = If( header=InlineIfHeader([Token(Token.ASSIGN, '${x} =', 3, 4), Token(Token.INLINE_IF, 'IF', 3, 14), Token(Token.ARGUMENT, 'True', 3, 20)]), body=[KeywordCall([Token(Token.KEYWORD, 'K1', 3, 28)])], orelse=If( header=ElseHeader([Token(Token.ELSE, 'ELSE', 3, 34)]), body=[KeywordCall([Token(Token.KEYWORD, 'K2', 3, 42)])], ), end=End([Token(Token.END, '', 3, 44)]) ) assert_model(node, expected)
def test_nested(self): data = ''' *** Test Cases *** Example IF ${x} IF ${y} K1 ELSE IF ${z} K2 ''' expected = If( header=InlineIfHeader([ Token(Token.INLINE_IF, 'IF', 3, 4), Token(Token.ARGUMENT, '${x}', 3, 10) ]), body=[ If( header=InlineIfHeader([ Token(Token.INLINE_IF, 'IF', 3, 18), Token(Token.ARGUMENT, '${y}', 3, 24) ]), body=[KeywordCall([Token(Token.KEYWORD, 'K1', 3, 32)])], orelse=If( header=ElseHeader([Token(Token.ELSE, 'ELSE', 3, 38)]), body=[ If( header=InlineIfHeader([ Token(Token.INLINE_IF, 'IF', 3, 46), Token(Token.ARGUMENT, '${z}', 3, 52) ]), body=[ KeywordCall( [Token(Token.KEYWORD, 'K2', 3, 60)]) ], end=End([Token(Token.END, '', 3, 62)]), ) ], ), errors=('Inline IF cannot be nested.', ), ) ], errors=('Inline IF cannot be nested.', ), ) get_and_assert_model(data, expected)
def test_try_except_else_finally(self): model = get_model('''\ *** Test Cases *** Example TRY Fail Oh no! EXCEPT does not match No operation EXCEPT AS ${exp} Log Catch ELSE No operation FINALLY Log finally here! END ''', data_only=True) node = model.sections[0].body[0].body[0] expected = Try( header=TryHeader([Token(Token.TRY, 'TRY', 3, 4)]), body=[KeywordCall([Token(Token.KEYWORD, 'Fail', 4, 8), Token(Token.ARGUMENT, 'Oh no!', 4, 16)])], next=Try( header=ExceptHeader([Token(Token.EXCEPT, 'EXCEPT', 5, 4), Token(Token.ARGUMENT, 'does not match', 5, 13)]), body=[KeywordCall((Token(Token.KEYWORD, 'No operation', 6, 8),))], next=Try( header=ExceptHeader((Token(Token.EXCEPT, 'EXCEPT', 7, 4), Token(Token.AS, 'AS', 7, 14), Token(Token.VARIABLE, '${exp}', 7, 20))), body=[KeywordCall((Token(Token.KEYWORD, 'Log', 8, 8), Token(Token.ARGUMENT, 'Catch', 8, 15)))], next=Try( header=ElseHeader((Token(Token.ELSE, 'ELSE', 9, 4),)), body=[KeywordCall((Token(Token.KEYWORD, 'No operation', 10, 8),))], next=Try( header=FinallyHeader((Token(Token.FINALLY, 'FINALLY', 11, 4),)), body=[KeywordCall((Token(Token.KEYWORD, 'Log', 12, 8), Token(Token.ARGUMENT, 'finally here!', 12, 15)))] ) ) ) ), end=End([Token(Token.END, 'END', 13, 4)]) ) assert_model(node, expected)
def test_if(self): data = ''' *** Test Cases *** Example IF True Keyword Another argument END ''' expected = If(header=IfHeader([ Token(Token.IF, 'IF', 3, 4), Token(Token.ARGUMENT, 'True', 3, 10), ]), body=[ KeywordCall([Token(Token.KEYWORD, 'Keyword', 4, 8)]), KeywordCall([ Token(Token.KEYWORD, 'Another', 5, 8), Token(Token.ARGUMENT, 'argument', 5, 19) ]) ], end=End([Token(Token.END, 'END', 6, 4)])) get_and_assert_model(data, expected)
def test_invalid(self): data1 = ''' *** Test Cases *** Example ${x} = ${y} IF ELSE ooops ELSE IF ''' data2 = ''' *** Test Cases *** Example IF e K ELSE ''' expected1 = If( header=InlineIfHeader([ Token(Token.ASSIGN, '${x} =', 3, 4), Token(Token.ASSIGN, '${y}', 3, 14), Token(Token.INLINE_IF, 'IF', 3, 22), Token(Token.ARGUMENT, 'ELSE', 3, 28) ]), body=[KeywordCall([Token(Token.KEYWORD, 'ooops', 3, 36)])], orelse=If( header=ElseIfHeader( [Token(Token.ELSE_IF, 'ELSE IF', 3, 45)], errors=('ELSE IF must have a condition.', )), errors=('ELSE IF branch cannot be empty.', ), ), end=End([Token(Token.END, '', 3, 52)])) expected2 = If(header=InlineIfHeader([ Token(Token.INLINE_IF, 'IF', 3, 4), Token(Token.ARGUMENT, 'e', 3, 10) ]), body=[KeywordCall([Token(Token.KEYWORD, 'K', 3, 15)])], orelse=If( header=ElseHeader( [Token(Token.ELSE, 'ELSE', 3, 20)]), errors=('ELSE branch cannot be empty.', ), ), end=End([Token(Token.END, '', 3, 24)])) get_and_assert_model(data1, expected1) get_and_assert_model(data2, expected2)
def test_if(self): model = get_model('''\ *** Test Cases *** Example IF True Keyword ''', data_only=True) node = model.sections[0].body[0].body[0] expected = If( header=InlineIfHeader([Token(Token.INLINE_IF, 'IF', 3, 4), Token(Token.ARGUMENT, 'True', 3, 10)]), body=[KeywordCall([Token(Token.KEYWORD, 'Keyword', 3, 18)])], end=End([Token(Token.END, '', 3, 25)]) ) assert_model(node, expected)
def test_if(self): model = get_model('''\ *** Test Cases *** Example IF True Keyword Another argument END ''', data_only=True) node = model.sections[0].body[0].body[0] expected = If( header=IfHeader([ Token(Token.IF, 'IF', 3, 4), Token(Token.ARGUMENT, 'True', 3, 10), ]), body=[ KeywordCall([Token(Token.KEYWORD, 'Keyword', 4, 8)]), KeywordCall([Token(Token.KEYWORD, 'Another', 5, 8), Token(Token.ARGUMENT, 'argument', 5, 19)]) ], end=End([Token(Token.END, 'END', 6, 4)]) ) assert_model(node, expected)
def test_if(self): data = ''' *** Test Cases *** Example IF True Keyword ''' expected = If( header=InlineIfHeader([ Token(Token.INLINE_IF, 'IF', 3, 4), Token(Token.ARGUMENT, 'True', 3, 10) ]), body=[KeywordCall([Token(Token.KEYWORD, 'Keyword', 3, 18)])], end=End([Token(Token.END, '', 3, 25)])) get_and_assert_model(data, expected)
def test_assign_only_inside(self): data = ''' *** Test Cases *** Example IF ${cond} ${assign} ''' expected = If( header=InlineIfHeader([ Token(Token.INLINE_IF, 'IF', 3, 4), Token(Token.ARGUMENT, '${cond}', 3, 10) ]), body=[KeywordCall([Token(Token.ASSIGN, '${assign}', 3, 21)])], end=End([Token(Token.END, '', 3, 30)]), errors=('Inline IF branches cannot contain assignments.', )) get_and_assert_model(data, expected)
def test_if_else_if_else(self): data = ''' *** Test Cases *** Example IF True K1 ELSE IF False K2 ELSE K3 ''' expected = If( header=InlineIfHeader([ Token(Token.INLINE_IF, 'IF', 3, 4), Token(Token.ARGUMENT, 'True', 3, 10) ]), body=[KeywordCall([Token(Token.KEYWORD, 'K1', 3, 18)])], orelse=If( header=ElseIfHeader([ Token(Token.ELSE_IF, 'ELSE IF', 3, 24), Token(Token.ARGUMENT, 'False', 3, 35) ]), body=[KeywordCall([Token(Token.KEYWORD, 'K2', 3, 44)])], orelse=If( header=ElseHeader([Token(Token.ELSE, 'ELSE', 3, 50)]), body=[KeywordCall([Token(Token.KEYWORD, 'K3', 3, 58)])], )), end=End([Token(Token.END, '', 3, 60)])) get_and_assert_model(data, expected)
def test_nested(self): model = get_model('''\ *** Test Cases *** Example FOR ${x} IN 1 2 FOR ${y} IN RANGE ${x} Log ${y} END END ''', data_only=True) loop = model.sections[0].body[0].body[0] expected = ForLoop( header=ForLoopHeader([ Token(Token.FOR, 'FOR', 3, 4), Token(Token.VARIABLE, '${x}', 3, 11), Token(Token.FOR_SEPARATOR, 'IN', 3, 19), Token(Token.ARGUMENT, '1', 3, 25), Token(Token.ARGUMENT, '2', 3, 30), ]), body=[ ForLoop( header=ForLoopHeader([ Token(Token.FOR, 'FOR', 4, 8), Token(Token.VARIABLE, '${y}', 4, 15), Token(Token.FOR_SEPARATOR, 'IN RANGE', 4, 23), Token(Token.ARGUMENT, '${x}', 4, 35), ]), body=[ KeywordCall([Token(Token.KEYWORD, 'Log', 5, 12), Token(Token.ARGUMENT, '${y}', 5, 19)]) ], end=End([ Token(Token.END, 'END', 6, 8) ]) ) ], end=End([ Token(Token.END, 'END', 7, 4) ]) ) assert_model(loop, expected) assert_equal(loop.error, None)
def test_valid(self): data = ''' *** Test Cases *** Example WHILE True Log ${x} END ''' expected = While(header=WhileHeader([ Token(Token.WHILE, 'WHILE', 3, 4), Token(Token.ARGUMENT, 'True', 3, 13), ]), body=[ KeywordCall([ Token(Token.KEYWORD, 'Log', 4, 8), Token(Token.ARGUMENT, '${x}', 4, 15) ]) ], end=End([Token(Token.END, 'END', 5, 4)])) get_and_assert_model(data, expected)
def test_invalid(self): model = get_model('''\ *** Test Cases *** Example ${x} = ${y} IF ELSE ooops ELSE IF ''', data_only=True) node = model.sections[0].body[0].body[0] expected = If( header=InlineIfHeader([Token(Token.ASSIGN, '${x} =', 3, 4), Token(Token.ASSIGN, '${y}', 3, 14), Token(Token.INLINE_IF, 'IF', 3, 22), Token(Token.ARGUMENT, 'ELSE', 3, 28)]), body=[KeywordCall([Token(Token.KEYWORD, 'ooops', 3, 36)])], orelse=If( header=ElseIfHeader([Token(Token.ELSE_IF, 'ELSE IF', 3, 45)], errors=('ELSE IF must have a condition.',)), errors=('ELSE IF branch cannot be empty.',), ), end=End([Token(Token.END, '', 3, 52)]) ) assert_model(node, expected)
def test_break(self): data = ''' *** Keywords *** Name WHILE True Break BREAK BREAK END ''' expected = While(header=WhileHeader([ Token(Token.WHILE, 'WHILE', 3, 4), Token(Token.ARGUMENT, 'True', 3, 13) ]), body=[ KeywordCall([ Token(Token.KEYWORD, 'Break', 4, 8), Token(Token.ARGUMENT, 'BREAK', 4, 17) ]), Break([Token(Token.BREAK, 'BREAK', 5, 8)]) ], end=End([Token(Token.END, 'END', 6, 4)])) get_and_assert_model(data, expected)
def test_return(self): data = ''' *** Keywords *** Name Return RETURN RETURN RETURN ''' expected = Keyword( header=KeywordName( tokens=[Token(Token.KEYWORD_NAME, 'Name', 2, 0)]), body=[ KeywordCall([ Token(Token.KEYWORD, 'Return', 3, 4), Token(Token.ARGUMENT, 'RETURN', 3, 14) ]), ReturnStatement([ Token(Token.RETURN_STATEMENT, 'RETURN', 4, 4), Token(Token.ARGUMENT, 'RETURN', 4, 14) ]) ], ) get_and_assert_model(data, expected, depth=1)
def test_valid(self): model = get_model('''\ *** Test Cases *** Example WHILE True Log ${x} END ''', data_only=True) loop = model.sections[0].body[0].body[0] expected = While(header=WhileHeader([ Token(Token.WHILE, 'WHILE', 3, 4), Token(Token.ARGUMENT, 'True', 3, 13), ]), body=[ KeywordCall([ Token(Token.KEYWORD, 'Log', 4, 8), Token(Token.ARGUMENT, '${x}', 4, 15) ]) ], end=End([Token(Token.END, 'END', 5, 4)])) assert_model(loop, expected)
def test_continue(self): data = ''' *** Keywords *** Name FOR ${x} IN @{stuff} Continue CONTINUE CONTINUE END ''' expected = For(header=ForHeader([ Token(Token.FOR, 'FOR', 3, 4), Token(Token.VARIABLE, '${x}', 3, 11), Token(Token.FOR_SEPARATOR, 'IN', 3, 19), Token(Token.ARGUMENT, '@{stuff}', 3, 25) ]), body=[ KeywordCall([ Token(Token.KEYWORD, 'Continue', 4, 8), Token(Token.ARGUMENT, 'CONTINUE', 4, 20) ]), Continue([Token(Token.CONTINUE, 'CONTINUE', 5, 8)]) ], end=End([Token(Token.END, 'END', 6, 4)])) get_and_assert_model(data, expected)
def test_valid(self): data = ''' *** Test Cases *** Example FOR ${x} IN a b c Log ${x} END ''' expected = For(header=ForHeader([ Token(Token.FOR, 'FOR', 3, 4), Token(Token.VARIABLE, '${x}', 3, 11), Token(Token.FOR_SEPARATOR, 'IN', 3, 19), Token(Token.ARGUMENT, 'a', 3, 25), Token(Token.ARGUMENT, 'b', 3, 30), Token(Token.ARGUMENT, 'c', 3, 35), ]), body=[ KeywordCall([ Token(Token.KEYWORD, 'Log', 4, 8), Token(Token.ARGUMENT, '${x}', 4, 15) ]) ], end=End([Token(Token.END, 'END', 5, 4)])) get_and_assert_model(data, expected)
TestCase(header=TestCaseName([ Token('TESTCASE_NAME', 'Example', 4, 0), Token('EOL', '\n', 4, 7) ]), body=[ Comment([ Token('SEPARATOR', ' ', 5, 0), Token('COMMENT', '# Comment', 5, 2), Token('EOL', '\n', 5, 11), ]), KeywordCall([ Token('SEPARATOR', ' ', 6, 0), Token('KEYWORD', 'Keyword', 6, 4), Token('SEPARATOR', ' ', 6, 11), Token('ARGUMENT', 'arg', 6, 15), Token('EOL', '\n', 6, 18), Token('SEPARATOR', ' ', 7, 0), Token('CONTINUATION', '...', 7, 4), Token('SEPARATOR', '\t', 7, 7), Token('ARGUMENT', 'argh', 7, 8), Token('EOL', '\n', 7, 12) ]), EmptyLine([Token('EOL', '\n', 8, 0)]), EmptyLine([Token('EOL', '\t\t\n', 9, 0)]) ]) ]), KeywordSection(header=KeywordSectionHeader([ Token('KEYWORD_HEADER', '*** Keywords ***', 10, 0), Token('EOL', '\n', 10, 16) ]), body=[ Comment([