示例#1
0
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"
示例#2
0
文件: test_funcs.py 项目: imbolc/Leaf
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//'
示例#3
0
文件: test_funcs.py 项目: imbolc/Leaf
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//'
示例#4
0
def get_document(raw_html_schedule):
    return leaf.parse(leaf.strip_symbols(leaf.strip_accents(show(raw_html_schedule))))
示例#5
0
def get_document(raw_html_schedule):
    return leaf.parse(
        leaf.strip_symbols(leaf.strip_accents(show(raw_html_schedule))))