mirror of
https://github.com/openwrt/packages.git
synced 2026-04-18 04:12:14 +00:00
- Bump version 0.18.16 -> 0.19.1 - Add PYPI_SOURCE_NAME:=ruamel_yaml - Add PKG_BUILD_BUILDIR, because folder is ruamel.yaml - Add test.sh Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
31 lines
665 B
Bash
31 lines
665 B
Bash
#!/bin/sh
|
|
|
|
[ "$1" = python3-ruamel-yaml ] || exit 0
|
|
|
|
python3 - << 'EOF'
|
|
from ruamel.yaml import YAML
|
|
from io import StringIO
|
|
|
|
yaml = YAML()
|
|
|
|
# Test basic load/dump
|
|
data = yaml.load("key: value\nlist:\n - a\n - b\n")
|
|
assert data["key"] == "value"
|
|
assert data["list"] == ["a", "b"]
|
|
|
|
out = StringIO()
|
|
yaml.dump({"x": 1}, out)
|
|
assert "x: 1" in out.getvalue()
|
|
|
|
# Test roundtrip comment preservation (key ruamel.yaml feature)
|
|
doc = "# header\nname: test # inline\n"
|
|
data2 = yaml.load(doc)
|
|
assert data2["name"] == "test"
|
|
buf = StringIO()
|
|
yaml.dump(data2, buf)
|
|
assert "# header" in buf.getvalue()
|
|
assert "# inline" in buf.getvalue()
|
|
|
|
print("python3-ruamel-yaml OK")
|
|
EOF
|