# Path: coldsweat/markup.py
# def strip_html(data):
#     '''
#     Strip all HTML tags and convert all entities/charrefs, effectively 
#       creating a plain text version of the input document
#     '''
#     p = Stripper()
#     _parse(p, data)
#     return p.output()


from ..markup import strip_html
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Description: HTML stripping tests

Copyright (c) 2013—2016 Andrea Peltrin
License: MIT (see LICENSE for details)
'''


def run_tests():
    tests = [
        ('a', 'a'),                                         # Identity
        ('a <p class="c"><span>b</span></p> a', 'a b a'),        
        (u'à <p class="c"><span>b</span></p> à', u'à b à'), # Unicode
        ('a&amp;a&lt;a&gt;', 'a&a<a>'),                     # Test unescape of entity and char reference too
        ('<span>a</span>', 'a'),
        ('<span>a', 'a'),                                   # Unclosed elements
        ('<p><span>a</p>', 'a'),    
        ('<foo attr=1><bar />a</foo>', 'a'),                # Non HTML tags
    ]
    
    for value, wanted in tests:

# Path: coldsweat/markup.py
# def strip_html(data):
#     '''
#     Strip all HTML tags and convert all entities/charrefs, effectively 
#       creating a plain text version of the input document
#     '''
#     p = Stripper()
#     _parse(p, data)
#     return p.output()


# Path: coldsweat/tests/strip.py
from ..markup import strip_html

#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Description: HTML stripping tests

Copyright (c) 2013—2016 Andrea Peltrin
License: MIT (see LICENSE for details)
'''


def run_tests():
    tests = [
        ('a', 'a'),                                         # Identity
        ('a <p class="c"><span>b</span></p> a', 'a b a'),        
        (u'à <p class="c"><span>b</span></p> à', u'à b à'), # Unicode
        ('a&amp;a&lt;a&gt;', 'a&a<a>'),                     # Test unescape of entity and char reference too
        ('<span>a</span>', 'a'),
        ('<span>a', 'a'),                                   # Unclosed elements
        ('<p><span>a</p>', 'a'),    
        ('<foo attr=1><bar />a</foo>', 'a'),                # Non HTML tags
    ]
    
    for value, wanted in tests:

        assert strip_html(value) == wanted