mirror of
https://github.com/openwrt/packages.git
synced 2026-04-15 19:02:09 +00:00
python-jmespath: bump to 1.1.0
Changes since 1.0.1: - Support for multi-select list/hash expressions with enhanced function argument validation - Minor performance improvements in expression parsing Also add test.sh to verify field access, wildcards, and filters. Link: https://github.com/jmespath/jmespath.py/blob/develop/CHANGELOG.rst Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
This commit is contained in:
committed by
Alexandru Ardelean
parent
ce2804c73f
commit
ba7acd594d
@@ -1,11 +1,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=python-jmespath
|
||||
PKG_VERSION:=1.0.1
|
||||
PKG_VERSION:=1.1.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PYPI_NAME:=jmespath
|
||||
PKG_HASH:=90261b206d6defd58fdd5e85f478bf633a2901798906be2ad389150c5c60edbe
|
||||
PKG_HASH:=472c87d80f36026ae83c6ddd0f1d05d4e510134ed462851fd5f754c8c3cbb88d
|
||||
|
||||
PKG_MAINTAINER:=Daniel Danzberger <daniel@dd-wrt.com>
|
||||
PKG_LICENSE:=MIT
|
||||
|
||||
39
lang/python/python-jmespath/test.sh
Executable file
39
lang/python/python-jmespath/test.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$1" = "python3-jmespath" ] || exit 0
|
||||
|
||||
python3 - << EOF
|
||||
import sys
|
||||
import jmespath
|
||||
|
||||
if jmespath.__version__ != "$2":
|
||||
print("Wrong version: " + jmespath.__version__)
|
||||
sys.exit(1)
|
||||
|
||||
# Basic field access
|
||||
data = {"name": "Alice", "age": 30}
|
||||
assert jmespath.search("name", data) == "Alice"
|
||||
assert jmespath.search("age", data) == 30
|
||||
assert jmespath.search("missing", data) is None
|
||||
|
||||
# Nested access
|
||||
data = {"a": {"b": {"c": 42}}}
|
||||
assert jmespath.search("a.b.c", data) == 42
|
||||
|
||||
# Array indexing and slicing
|
||||
data = {"items": [1, 2, 3, 4, 5]}
|
||||
assert jmespath.search("items[0]", data) == 1
|
||||
assert jmespath.search("items[-1]", data) == 5
|
||||
assert jmespath.search("items[1:3]", data) == [2, 3]
|
||||
|
||||
# Wildcard and filter
|
||||
data = {"people": [{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]}
|
||||
assert jmespath.search("people[].name", data) == ["Alice", "Bob"]
|
||||
assert jmespath.search("people[?age > \`28\`].name", data) == ["Alice"]
|
||||
|
||||
# Pre-compiled expression
|
||||
expr = jmespath.compile("a.b")
|
||||
assert expr.search({"a": {"b": 99}}) == 99
|
||||
|
||||
sys.exit(0)
|
||||
EOF
|
||||
Reference in New Issue
Block a user