Beispiel #1
0
def test_postcleanxml():
    """Test postcleanxml."""
    assert numerate.postcleanxml('test') == 'test'
    assert numerate.postcleanxml("`") == "'"
    assert numerate.postcleanxml('C&U;') == 'C&U'
    assert numerate.postcleanxml(' & ') == ' and '
    assert numerate.postcleanxml('\t') == ''
    assert numerate.postcleanxml('\t\t') == ''
    assert numerate.postcleanxml('\t\t\t') == ''
    assert numerate.postcleanxml('\n') == '\n'
    assert numerate.postcleanxml('\n\n') == '\n'
    assert numerate.postcleanxml('\n\n\n') == '\n'
Beispiel #2
0
def test_cleanxml():
    """Test cleanxml."""
    stringin = '''
<screen>
    BBB & CCC  C&U;  this ' and ` that code


        DDD & EEE  C&U;  this ' and ` that code
</screen>
'''

    stringout = '''
<screen>BBB and CCC C&amp;U this ' and ' that code
DDD and EEE C&amp;U this ' and ' that code</screen>
'''

    stringin = numerate.precleanxml(stringin)
    stringin = numerate.postcleanxml(stringin)
    assert stringin == stringout