File: test_unidecode.py

package info (click to toggle)
python-text-unidecode 1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 412 kB
  • sloc: python: 76; makefile: 9; perl: 6
file content (25 lines) | stat: -rw-r--r-- 756 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from text_unidecode import unidecode
import pytest


@pytest.mark.parametrize(("text", "result"), [
    ("Programmes de publicité - Solutions d'entreprise", "Programmes de publicite - Solutions d'entreprise"),
    ("Транслитерирует и русский", "Transliteriruet i russkii"),
    ("kožušček", "kozuscek"),
    ("北亰", "Bei Jing "),
])
def test_transliterate(text, result):
    assert unidecode(text) == result


@pytest.mark.parametrize("code", range(128))
def test_7bit_purity(code):
    ch = chr(code)
    assert unidecode(ch) == ch


def test_7bit_text_purity():
    txt = "".join([chr(x) for x in range(128)])
    assert unidecode(txt) == txt