]> git.99rst.org Git - openwrt-packages.git/commitdiff
python-marshmallow: add test script
authorAlexandru Ardelean <redacted>
Sun, 9 Aug 2026 09:40:50 +0000 (12:40 +0300)
committerAlexandru Ardelean <redacted>
Tue, 11 Aug 2026 08:04:22 +0000 (11:04 +0300)
Add a CI test.sh exercising basic package functionality.

Signed-off-by: Alexandru Ardelean <redacted>
lang/python/python-marshmallow/test.sh [new file with mode: 0755]

diff --git a/lang/python/python-marshmallow/test.sh b/lang/python/python-marshmallow/test.sh
new file mode 100755 (executable)
index 0000000..c8b8d84
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+[ "$1" = python3-marshmallow ] || exit 0
+
+python3 - << 'EOF'
+
+from marshmallow import Schema, fields, ValidationError
+
+# Round-trip a schema: dump a dict, load and type-coerce it back, then confirm
+# a missing required field is rejected with ValidationError.
+class UserSchema(Schema):
+    name = fields.Str(required=True)
+    age = fields.Int()
+
+s = UserSchema()
+assert s.dump({"name": "ow", "age": 3}) == {"name": "ow", "age": 3}
+assert s.load({"name": "ow", "age": "5"}) == {"name": "ow", "age": 5}
+try:
+    s.load({"age": 1})
+    raise SystemExit("required field not enforced")
+except ValidationError:
+    pass
+
+EOF
git clone https://git.99rst.org/PROJECT