mirror of
https://github.com/openwrt/packages.git
synced 2026-04-15 10:51:55 +00:00
python-xmltodict: update to 1.0.4
Update package to 1.0.4. Add test.sh to verify XML parsing and unparsing functionality. Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
This commit is contained in:
committed by
Alexandru Ardelean
parent
10a5d4024c
commit
e05e7ab598
@@ -8,16 +8,18 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=python-xmltodict
|
||||
PKG_VERSION:=0.13.0
|
||||
PKG_VERSION:=1.0.4
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PYPI_NAME:=xmltodict
|
||||
PKG_HASH:=341595a488e3e01a85a9d8911d8912fd922ede5fecc4dce437eb4b6c8d037e56
|
||||
PKG_HASH:=6d94c9f834dd9e44514162799d344d815a3a4faec913717a9ecbfa5be1bb8e61
|
||||
|
||||
PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_BUILD_DEPENDS:=python-setuptools/host
|
||||
|
||||
include ../pypi.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../python3-package.mk
|
||||
|
||||
29
lang/python/python-xmltodict/test.sh
Normal file
29
lang/python/python-xmltodict/test.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
[ "$1" = python3-xmltodict ] || exit 0
|
||||
|
||||
python3 - << 'EOF'
|
||||
import xmltodict
|
||||
|
||||
# Basic XML to dict conversion
|
||||
xml = """<root>
|
||||
<name>test</name>
|
||||
<value>42</value>
|
||||
<items>
|
||||
<item>a</item>
|
||||
<item>b</item>
|
||||
</items>
|
||||
</root>"""
|
||||
data = xmltodict.parse(xml)
|
||||
assert data['root']['name'] == 'test'
|
||||
assert data['root']['value'] == '42'
|
||||
assert isinstance(data['root']['items']['item'], list)
|
||||
assert data['root']['items']['item'] == ['a', 'b']
|
||||
|
||||
# Dict to XML conversion
|
||||
d = {'doc': {'title': 'Hello', 'body': 'World'}}
|
||||
result = xmltodict.unparse(d)
|
||||
assert '<title>Hello</title>' in result
|
||||
assert '<body>World</body>' in result
|
||||
|
||||
print("xmltodict OK")
|
||||
EOF
|
||||
Reference in New Issue
Block a user