Example #1
0
def test_non_quoted_attribute_name_following_value_empty():
    """
    Make sure to test an attribute name with a following non-quoted value that is empty.
    """

    # Arrange
    input_tag_name = "<meta http:equiv=="
    start_index = 16
    expected_resultant_index = -1

    # Act
    actual_resultant_index = HtmlHelper.extract_optional_attribute_value(
        input_tag_name, start_index)

    # Assert
    assert expected_resultant_index == actual_resultant_index
Example #2
0
def test_single_quoted_attribute_name_following_value_and_no_close():
    """
    Make sure to test an attribute name with a following single quoted value that has no close tag.
    """

    # Arrange
    input_tag_name = "<meta http:equiv='foo'"
    start_index = 16
    expected_resultant_index = len(input_tag_name)

    # Act
    actual_resultant_index = HtmlHelper.extract_optional_attribute_value(
        input_tag_name, start_index)

    # Assert
    assert expected_resultant_index == actual_resultant_index
Example #3
0
def test_single_quoted_attribute_name_following_value_and_whitespace_around():
    """
    Make sure to test an attribute name with a following single quoted value with whitespace around it.
    """

    # Arrange
    input_tag_name = "<meta http:equiv = 'foo'>"
    start_index = 16
    expected_resultant_index = 24

    # Act
    actual_resultant_index = HtmlHelper.extract_optional_attribute_value(
        input_tag_name, start_index)

    # Assert
    assert expected_resultant_index == actual_resultant_index
Example #4
0
def test_double_quoted_attribute_name_following_value_not_empty():
    """
    Make sure to test an attribute name with a following double quoted value that is not empty.
    """

    # Arrange
    input_tag_name = '<meta http:equiv="foo">'
    start_index = 16
    expected_resultant_index = 22

    # Act
    actual_resultant_index = HtmlHelper.extract_optional_attribute_value(
        input_tag_name, start_index)

    # Assert
    assert expected_resultant_index == actual_resultant_index
Example #5
0
def test_attribute_name_equals_sign_and_close():
    """
    Make sure to test an attribute name with a following equal sign and a close.
    """

    # Arrange
    input_tag_name = "<meta http:equiv=>"
    start_index = 16
    expected_resultant_index = -1

    # Act
    actual_resultant_index = HtmlHelper.extract_optional_attribute_value(
        input_tag_name, start_index)

    # Assert
    assert expected_resultant_index == actual_resultant_index
Example #6
0
def test_no_attribute_name_following_value_and_no_close():
    """
    Make sure to test an attribute name without a following attribute value and no close bracket.
    """

    # Arrange
    input_tag_name = "<meta http:equiv"
    start_index = 16
    expected_resultant_index = len(input_tag_name)

    # Act
    actual_resultant_index = HtmlHelper.extract_optional_attribute_value(
        input_tag_name, start_index)

    # Assert
    assert expected_resultant_index == actual_resultant_index