示例#1
0
    def test_dangling_feature_tags():
        # Raise exception if there are any tags without a feature definition.
        contents = "\n".join([
            "@dangling",
        ])

        with assert_raises(ParsingError) as error_context:
            parse_bank(contents)

        assert_in("dangling tags", error_context.exception.message.lower())
        assert_equal(1, error_context.exception.line)
示例#2
0
    def test_feature_tags_not_followed_by_feature():
        contents = "\n".join([
            "@these_are_feature_tags",
            "@they_should_be_followed_only_by_a_feature",
            "Scenario: This is an error of some kind",
        ])

        with assert_raises(ParsingError) as error_context:
            parse_bank(contents)

        assert_in("invalid line", error_context.exception.message.lower())
        assert_equal(3, error_context.exception.line)
示例#3
0
    def test_dangling_scenario_tags():
        contents = "\n".join([
            "Feature: Tags and the end of the file",
            "    Scenario: A bad scenario",
            "        Given we a scenario",
            "        And then some tags come out of nowhere, really",
            "        @this_is_bad",
        ])

        with assert_raises(ParsingError) as error_context:
            parse_bank(contents)

        assert_in("dangling tags", error_context.exception.message.lower())
        assert_equal(5, error_context.exception.line)
示例#4
0
    def test_multiline_text_error():
        # If a multiline text is started but not finished, raise a parser error.
        contents = "\n".join([
            "Feature: A multiline text error",
            "    Scenario: A bad scenario",
            "        Given a multiline text that isn't closed:",
            "            \"\"\"",
            "            This multiline text has no end!",
        ])

        with assert_raises(ParsingError) as error_context:
            parse_bank(contents)

        assert_in("multiline", error_context.exception.message.lower())
        assert_equal(4, error_context.exception.line)