mirror of
https://github.com/qurator-spk/dinglehopper.git
synced 2025-07-01 22:50:08 +02:00
Installing was broken since moving to pyproject.toml, which we didn't notice because of
leftover files in build/. Fix this by using the convention of having the source files
in src/ and adjusting pyproject.toml accordingly.
Fixes gh-86. 🤞
23 lines
856 B
Python
23 lines
856 B
Python
import unicodedata
|
|
|
|
from .. import editops
|
|
|
|
|
|
def test_editops():
|
|
"""Test editops() in cases where dealing with grapheme clusters matters"""
|
|
|
|
# In these cases, one of the words has a composed form, the other one does not.
|
|
# (Also, note that old terminal emulators might not render the combining characters
|
|
# correctly, be sure to read in an editor.)
|
|
assert editops("Schlyñ", "Schlym̃") == [("replace", 5, 5)]
|
|
assert editops("oͤde", "öde") == [("replace", 0, 0)]
|
|
|
|
|
|
def test_editops_canonically_equivalent():
|
|
left = unicodedata.lookup("LATIN SMALL LETTER N") + unicodedata.lookup(
|
|
"COMBINING TILDE"
|
|
)
|
|
right = unicodedata.lookup("LATIN SMALL LETTER N WITH TILDE")
|
|
assert left != right
|
|
assert unicodedata.normalize("NFC", left) == unicodedata.normalize("NFC", right)
|
|
assert editops(left, right) == []
|