From f46fc0fed089402718fe5b637007bd10eacfb1ba Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Sun, 9 Aug 2026 12:40:50 +0300 Subject: [PATCH] python-msgpack: add test script Add a CI test.sh exercising basic package functionality. Signed-off-by: Alexandru Ardelean --- lang/python/python-msgpack/test.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 lang/python/python-msgpack/test.sh diff --git a/lang/python/python-msgpack/test.sh b/lang/python/python-msgpack/test.sh new file mode 100755 index 0000000000..a6de1b8cb8 --- /dev/null +++ b/lang/python/python-msgpack/test.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +[ "$1" = python3-msgpack ] || exit 0 + +python3 - << 'EOF' + +import msgpack + +# Pack a mixed-type structure and unpack it back, then confirm the compiled C +# extension is actually in use rather than the pure-Python fallback (which the +# package silently drops to when the Cython build produced nothing). +obj = {"a": [1, 2, 3], "b": "text", "c": 3.5, "d": True, "e": None} +packed = msgpack.packb(obj) +assert isinstance(packed, (bytes, bytearray)) +assert msgpack.unpackb(packed, raw=False) == obj +assert msgpack.Packer.__module__ == "msgpack._cmsgpack", msgpack.Packer.__module__ + +EOF