Exemplo n.º 1
0
    ...\targh

\t\t
*** Keywords ***
# Comment    continues
Keyword
    [Arguments]    ${arg1}    ${arg2}
    Log    Got ${arg1} and ${arg}!
'''
PATH = os.path.join(os.getenv('TEMPDIR') or tempfile.gettempdir(),
                    'test_model.robot')
EXPECTED = File(sections=[
    CommentSection(
        body=[
            EmptyLine([
                Token('EOL', '\n', 1, 0)
            ])
        ]
    ),
    TestCaseSection(
        header=SectionHeader([
            Token('TESTCASE HEADER', '*** Test Cases ***', 2, 0),
            Token('EOL', '\n', 2, 18)
        ]),
        body=[
            EmptyLine([Token('EOL', '\n', 3, 0)]),
            TestCase(
                header=TestCaseName([
                    Token('TESTCASE NAME', 'Example', 4, 0),
                    Token('EOL', '\n', 4, 7)
                ]),
Exemplo n.º 2
0
Example
  # Comment
    Keyword    arg
    ...\targh

\t\t
*** Keywords ***
# Comment    continues
Keyword
    [Arguments]    ${arg1}    ${arg2}
    Log    Got ${arg1} and ${arg}!
'''
PATH = os.path.join(
    os.getenv('TEMPDIR') or tempfile.gettempdir(), 'test_model.robot')
EXPECTED = File(sections=[
    CommentSection(body=[EmptyLine([Token('EOL', '\n', 1, 0)])]),
    TestCaseSection(header=TestCaseSectionHeader([
        Token('TESTCASE_HEADER', '*** Test Cases ***', 2, 0),
        Token('EOL', '\n', 2, 18)
    ]),
                    body=[
                        EmptyLine([Token('EOL', '\n', 3, 0)]),
                        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),
Exemplo n.º 3
0
 def visit_Section(self, node):
     if node != self.sections[-1]:
         node.body.add(EmptyLine([Token(Token.EOL, self._newline)]))
     self.generic_visit(node)
     return node
Exemplo n.º 4
0
 def visit_Keyword(self, node):
     if not node.body.items or node != self.keywords[-1]:
         node.body.items.append(EmptyLine([Token(Token.EOL,
                                                 self._newline)]))
     self.generic_visit(node)
     return node
Exemplo n.º 5
0
 def visit_TestCase(self, node):
     if not node.body.items or node != self.tests[-1]:
         node.body.items.append(EmptyLine.from_value(self.newline))
     self.generic_visit(node)
     return node
Exemplo n.º 6
0
 def visit_Keyword(self, node):
     if not node.body.items or node != self.keywords[-1]:
         node.body.items.append(EmptyLine.from_value(self.newline))
     self.generic_visit(node)
     return node
Exemplo n.º 7
0
 def visit_Section(self, node):
     if node != self.sections[-1]:
         node.body.add(EmptyLine.from_value(self.newline))
     self.generic_visit(node)
     return node
Exemplo n.º 8
0
DATA = '''
*** Test Cases ***
Example
    Keyword    arg
    ...    argh

*** Keywords ***
Keyword
    [Arguments]    ${arg1}    ${arg2}
    Log    Got ${arg1} and ${arg}!
'''
PATH = os.path.join(
    os.getenv('TEMPDIR') or tempfile.gettempdir(), 'test_model.robot')
EXPECTED = File(sections=[
    CommentSection(body=[EmptyLine([Token('EOL', '\n', 1, 0)])]),
    TestCaseSection(header=TestCaseSectionHeader([
        Token('TESTCASE_HEADER', '*** Test Cases ***', 2, 0),
        Token('EOL', '\n', 2, 18)
    ]),
                    body=[
                        TestCase(header=TestCaseName([
                            Token('TESTCASE_NAME', 'Example', 3, 0),
                            Token('EOL', '\n', 3, 7)
                        ]),
                                 body=[
                                     KeywordCall([
                                         Token('SEPARATOR', '    ', 4, 0),
                                         Token('KEYWORD', 'Keyword', 4, 4),
                                         Token('SEPARATOR', '    ', 4, 11),
                                         Token('ARGUMENT', 'arg', 4, 15),
Exemplo n.º 9
0
 def visit_Keyword(self, node):
     if not node.body or node is not self.last_keyword:
         node.body.append(EmptyLine.from_value(self.newline))
     return self.generic_visit(node)
Exemplo n.º 10
0
 def visit_TestCase(self, node):
     if not node.body or node is not self.last_test:
         node.body.append(EmptyLine.from_value(self.newline))
     return self.generic_visit(node)
Exemplo n.º 11
0
 def visit_Section(self, node):
     if node is not self.last_section:
         node.body.append(EmptyLine.from_value(self.newline))
     return self.generic_visit(node)