Exemplo n.º 1
0
def test_normalize_codec_compat(form, data, expect):
    normalize = textnorm.UnicodeNormalizer(form, codec=True)
    norm = normalize(data)
    assert norm == (expect, len(data))
Exemplo n.º 2
0
def test_normalize(form, data, expect):
    normalize = textnorm.UnicodeNormalizer(form)
    norm = normalize(data)
    assert norm == expect
Exemplo n.º 3
0
def test_normalize_codec_init():
    codec = textnorm.UnicodeNormalizer('NFC', True)
    assert codec.codec is True
Exemplo n.º 4
0
def test_normalize_invalid_form():
    with pytest.raises(ValueError):
        textnorm.UnicodeNormalizer('NFE')
Exemplo n.º 5
0
def test_normalize_init(form):
    normalize = textnorm.UnicodeNormalizer(form)
    assert normalize.form == form
    assert normalize.codec is False