mirror of
https://github.com/openwrt/packages.git
synced 2025-12-23 11:01:25 +00:00
python-rpds-py: Add new package
From the README: Python bindings to the Rust rpds crate for persistent data structures. Signed-off-by: Jeffery To <jeffery.to@gmail.com>
This commit is contained in:
committed by
Tianling Shen
parent
5bc25c0cdc
commit
06231ce8cb
21
lang/python/python-rpds-py/test.sh
Normal file
21
lang/python/python-rpds-py/test.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$1" = python3-rpds-py ] || exit 0
|
||||
|
||||
python3 - << 'EOF'
|
||||
|
||||
from rpds import HashTrieMap, HashTrieSet, List
|
||||
|
||||
m = HashTrieMap({"foo": "bar", "baz": "quux"})
|
||||
assert m.insert("spam", 37) == HashTrieMap({"foo": "bar", "baz": "quux", "spam": 37})
|
||||
assert m.remove("foo") == HashTrieMap({"baz": "quux"})
|
||||
|
||||
s = HashTrieSet({"foo", "bar", "baz", "quux"})
|
||||
assert s.insert("spam") == HashTrieSet({"foo", "bar", "baz", "quux", "spam"})
|
||||
assert s.remove("foo") == HashTrieSet({"bar", "baz", "quux"})
|
||||
|
||||
L = List([1, 3, 5])
|
||||
assert L.push_front(-1) == List([-1, 1, 3, 5])
|
||||
assert L.rest == List([3, 5])
|
||||
|
||||
EOF
|
||||
Reference in New Issue
Block a user