コード例 #1
0
    def test_model_error_with_error_and_fatal_error(self):
        model = get_resource_model('''\
*** Invalid ***
*** Settings ***
Invalid
Documentation
*** Test Cases ***
''',
                                   data_only=True)
        inv_header = (
            "Unrecognized section header '*** Invalid ***'. Valid sections: "
            "'Settings', 'Variables', 'Keywords' and 'Comments'.")
        inv_setting = "Non-existing setting 'Invalid'."
        inv_testcases = "Resource file with 'Test Cases' section is invalid."
        expected = File([
            CommentSection(body=[
                Error([Token('ERROR', '*** Invalid ***', 1, 0, inv_header)])
            ]),
            SettingSection(
                header=SectionHeader(
                    [Token('SETTING HEADER', '*** Settings ***', 2, 0)]),
                body=[
                    Error([Token('ERROR', 'Invalid', 3, 0, inv_setting)]),
                    Documentation(
                        [Token('DOCUMENTATION', 'Documentation', 4, 0)]),
                    Error([
                        Token('FATAL ERROR', '*** Test Cases ***', 5, 0,
                              inv_testcases)
                    ])
                ])
        ])
        assert_model(model, expected)
コード例 #2
0
    def test_model(self):
        model = get_model('''\
*** Invalid ***
*** Settings ***
Invalid
Documentation
''', data_only=True)
        inv_header = (
            "Unrecognized section header '*** Invalid ***'. Valid sections: "
            "'Settings', 'Variables', 'Test Cases', 'Tasks', 'Keywords' and 'Comments'."
        )
        inv_setting = "Non-existing setting 'Invalid'."
        expected = File([
            CommentSection(
                body=[
                    Error([Token('ERROR', '*** Invalid ***', 1, 0, inv_header)])
                ]
            ),
            SettingSection(
                header=SectionHeader([
                    Token('SETTING HEADER', '*** Settings ***', 2, 0)
                ]),
                body=[
                    Error([Token('ERROR', 'Invalid', 3, 0, inv_setting)]),
                    Documentation([Token('DOCUMENTATION', 'Documentation', 4, 0)])
                ]
            )
        ])
        assert_model(model, expected)