import pytest
from .context import blogger_html_cleaner


class TestTagTools():

    def test_get_pure_tag(self):
        tag1 = '<div>'
        tag2 = '</div>'
        tag3 = '<pre class="prettyprint">'

        assert blogger_html_cleaner.cleaner.get_pure_tag(tag1) == '<div>'
        assert blogger_html_cleaner.cleaner.get_pure_tag(tag2) == '</div>'
        assert blogger_html_cleaner.cleaner.get_pure_tag(tag3) == '<pre>'

    def test_tag_match(self):
        tag1 = '<div>'
        tag2 = '</div>'
        tag3 = '<pre>'
        tag4 = '</pre>'

        assert blogger_html_cleaner.cleaner.tag_match(tag1, tag2) == True
        assert blogger_html_cleaner.cleaner.tag_match(tag1, tag1) == False
        assert blogger_html_cleaner.cleaner.tag_match(tag3, tag2) == False
        assert blogger_html_cleaner.cleaner.tag_match(tag3, tag3) == False
        assert blogger_html_cleaner.cleaner.tag_match(tag3, tag4) == True


class TestUnclosedTagRemover():

    def test_find_next_unclosed(self):
        text = ''

        with open('unclosed') as f:
            text = f.read()

        unclosed = blogger_html_cleaner.cleaner.find_next_unclosed(text)
        assert unclosed == (231, 254)

@@ -921,17 +921,16 @@
 = True%0A%0A
-%0A
 class Te
@@ -1150,16 +1150,16 @@
 d(text)%0A
-
         
@@ -1188,8 +1188,334 @@
 1, 254)%0A
+%0A    def test_remove_unclosed(self):%0A        text = ''%0A        expected = ''%0A%0A        with open('unclosed') as f:%0A            text = f.read()%0A%0A        with open('unclosed_expected') as f:%0A            expected = f.read()%0A%0A        removed = blogger_html_cleaner.cleaner.remove_unclosed(text)%0A%0A        assert removed == expected%0A

Add remove_unclosed() test