Skip to content

Commit 7d3f341

Browse files
committed
Add tests
1 parent 98211a3 commit 7d3f341

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/snippets/unicode_fu.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,21 @@
1919
assert unicodedata.lookup('LATIN SMALL LETTER A') == 'a'
2020
assert unicodedata.bidirectional('a') == 'L'
2121
assert unicodedata.normalize('NFC', 'bla') == 'bla'
22+
23+
# testing unicodedata.ucd_3_2_0 for idna
24+
assert "abcСĤ".encode("idna") == b'xn--abc-7sa390b'
25+
# TODO: fix: assert "abc䄣IJ".encode("idna") == b'xn--abcij-zb5f'
26+
27+
# from CPython tests
28+
assert "python.org".encode("idna") == b"python.org"
29+
assert "python.org.".encode("idna") == b"python.org."
30+
assert "pyth\xf6n.org".encode("idna") == b"xn--pythn-mua.org"
31+
assert "pyth\xf6n.org.".encode("idna") == b"xn--pythn-mua.org."
32+
assert b"python.org".decode("idna") == "python.org"
33+
assert b"python.org.".decode("idna") == "python.org."
34+
assert b"xn--pythn-mua.org".decode("idna") == "pyth\xf6n.org"
35+
assert b"xn--pythn-mua.org.".decode("idna") == "pyth\xf6n.org."
36+
37+
# TODO: add east_asian_width and mirrored
38+
# assert unicodedata.ucd_3_2_0.east_asian_width('\u231a') == 'N'
39+
# assert not unicodedata.ucd_3_2_0.mirrored("\u0f3a")

0 commit comments

Comments
 (0)