def test_attribute_name_runs_out_of_string(): """ Make sure to test an attribute name that runs out of space in the string. """ # Arrange input_tag_text = "<meta httpequiv" start_index = 6 expected_resultant_index = -1 # Act actual_resultant_index = HtmlHelper.extract_html_attribute_name( input_tag_text, start_index) # Assert assert expected_resultant_index == actual_resultant_index
def test_invalid_attribute_name(): """ Make sure to test an attribute name that is invalid. """ # Arrange input_tag_text = "<meta http*equiv='foo'>" start_index = 6 expected_resultant_index = -1 # Act actual_resultant_index = HtmlHelper.extract_html_attribute_name( input_tag_text, start_index) # Assert assert expected_resultant_index == actual_resultant_index
def test_invalid_attribute_name_start(): """ Make sure to test an attribute name that has an invalid start character """ # Arrange input_tag_text = "<meta -http='foo'>" start_index = 6 expected_resultant_index = -1 # Act actual_resultant_index = HtmlHelper.extract_html_attribute_name( input_tag_text, start_index) # Assert assert expected_resultant_index == actual_resultant_index
def test_coloned_attribute_name(): """ Make sure to test an attribute name with a colon. """ # Arrange input_tag_text = "<meta http:equiv='foo'>" start_index = 6 expected_resultant_index = 16 # Act actual_resultant_index = HtmlHelper.extract_html_attribute_name( input_tag_text, start_index) # Assert assert expected_resultant_index == actual_resultant_index
def test_dashed_attribute_name(): """ Make sure to test an attribute name with a dash. """ # Arrange input_tag_text = "<form accept-charset='foo'>" start_index = 6 expected_resultant_index = 20 # Act actual_resultant_index = HtmlHelper.extract_html_attribute_name( input_tag_text, start_index) # Assert assert expected_resultant_index == actual_resultant_index
def test_simple_attribute_name(): """ Make sure to test a simple attribute name. """ # Arrange input_tag_text = "<a href='foo'>" start_index = 3 expected_resultant_index = 7 # Act actual_resultant_index = HtmlHelper.extract_html_attribute_name( input_tag_text, start_index) # Assert assert expected_resultant_index == actual_resultant_index