aboutsummaryrefslogtreecommitdiff
path: root/lang/python/python-idna/test.sh
diff options
context:
space:
mode:
authorJeffery To <jeffery.to@gmail.com>2023-11-28 09:13:57 +0800
committerTianling Shen <cnsztl@gmail.com>2023-11-30 12:58:06 +0800
commit7d1febb77fde235fd960ec3dbf021da52f618ecf (patch)
tree30e3a325b809409c17893dfe17fca75695ab5d10 /lang/python/python-idna/test.sh
parent41e500535cade1552d65e040e723c0353059f481 (diff)
python-idna: Update to 3.6
This also adds a test.sh script for the packages feed CI. Signed-off-by: Jeffery To <jeffery.to@gmail.com>
Diffstat (limited to 'lang/python/python-idna/test.sh')
-rw-r--r--lang/python/python-idna/test.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/lang/python/python-idna/test.sh b/lang/python/python-idna/test.sh
new file mode 100644
index 000000000..85f779c23
--- /dev/null
+++ b/lang/python/python-idna/test.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+[ "$1" = python3-idna ] || exit 0
+
+python3 - << 'EOF'
+
+import idna
+import idna.codec
+
+assert idna.encode('ドメイン.テスト') == b'xn--eckwd4c7c.xn--zckzah'
+assert idna.decode('xn--eckwd4c7c.xn--zckzah') == 'ドメイン.テスト'
+
+assert 'домен.испытание'.encode('idna2008') == b'xn--d1acufc.xn--80akhbyknj4f'
+assert b'xn--d1acufc.xn--80akhbyknj4f'.decode('idna2008') == 'домен.испытание'
+
+assert idna.alabel('测试') == b'xn--0zwm56d'
+
+assert idna.encode('Königsgäßchen', uts46=True) == b'xn--knigsgchen-b4a3dun'
+assert idna.decode('xn--knigsgchen-b4a3dun') == 'königsgäßchen'
+
+assert idna.encode('Königsgäßchen', uts46=True, transitional=True) == b'xn--knigsgsschen-lcb0w'
+
+EOF