Example #1
0
def test_complete_html_start_tag_with_normal_opening_tag():
    """
    Make sure to test a simple complete html start tag with multiple attributes.
    """

    # Arrange
    input_tag_name = "a"
    string_to_parse = " show>"
    parse_index = 0
    expected_is_valid = True

    # Act
    actual_is_valid, parse_index = HtmlHelper.is_complete_html_start_tag(
        input_tag_name, string_to_parse, parse_index)

    # Assert
    assert expected_is_valid == actual_is_valid
    assert parse_index == 6
Example #2
0
def test_complete_html_start_tag_with_invalidly_named_no_value_attributes():
    """
    Make sure to test a simple complete html start tag with a single attribute that has an invalid name.
    """

    # Arrange
    input_tag_name = "a"
    string_to_parse = " sh*ow>"
    parse_index = 0
    expected_is_valid = False

    # Act
    actual_is_valid, parse_index = HtmlHelper.is_complete_html_start_tag(
        input_tag_name, string_to_parse, parse_index)

    # Assert
    assert expected_is_valid == actual_is_valid
    assert parse_index == 1
Example #3
0
def test_complete_html_start_tag_with_single_attribute_with_whitespace():
    """
    Make sure to test a simple complete html start tag with a single attribute with whitespace.
    """

    # Arrange
    input_tag_name = "a"
    string_to_parse = " show = '1' >"
    parse_index = 0
    expected_is_valid = True

    # Act
    actual_is_valid, parse_index = HtmlHelper.is_complete_html_start_tag(
        input_tag_name, string_to_parse, parse_index)

    # Assert
    assert expected_is_valid == actual_is_valid
    assert parse_index == 13
Example #4
0
def test_simple_complete_html_start_tag_with_bad_tag_name():
    """
    Make sure to test a simple complete html start tag with a bad tag name.
    """

    # Arrange
    input_tag_name = "a*b"
    string_to_parse = ">"
    parse_index = 0
    expected_is_valid = False

    # Act
    actual_is_valid, parse_index = HtmlHelper.is_complete_html_start_tag(
        input_tag_name, string_to_parse, parse_index)

    # Assert
    assert expected_is_valid == actual_is_valid
    assert parse_index == 1