def test_bbcode(): document = leaf.parse(sample) bbcode = document.parse(bbcode_formatter, 'http://example.com/') bbcode = leaf.strip_spaces(bbcode) bbcode = leaf.strip_symbols(bbcode) bbcode = leaf.strip_linebreaks(bbcode) assert bbcode == leaf.to_unicode(sample_result), "Sample bbcode formatter"
def test_strip_symbols(): bad_string = u"""b̼̘̬ͭ͂̈́̀l͇͉̱͚̲̗̗͞a̱̭̬͎͉̤ͨ͂̌̑̓͂͐h̬̯̻̩͗ͩͯb̢̬͕͈̥̅̌͆̔̉ͅĺ̘̖̼͚͒̈́̏͌̃͟ ͎̮̫̍ͫ̽͐͋ͤ͂a̜͔̩͇̩̪͐̍̐̃ͤ͑ ̦̌ḧ̙̝͓̜͕̝́ͅb̛̞͔̽̃̍ͪla̘̠͖͍̣͙̝͌ͪ͒̃ͯ ͗͛̆͊.̛̭̜̞̲͓̯ͧ̅h͂͑/̢̊/̠̘͖͖̖̺̯""" assert leaf.strip_symbols(bad_string) == u'blahbl a hbla .h//'
def get_document(raw_html_schedule): return leaf.parse(leaf.strip_symbols(leaf.strip_accents(show(raw_html_schedule))))
def get_document(raw_html_schedule): return leaf.parse( leaf.strip_symbols(leaf.strip_accents(show(raw_html_schedule))))