diff options
Diffstat (limited to 'lang/python/python-rpds-py/test.sh')
| -rw-r--r-- | lang/python/python-rpds-py/test.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lang/python/python-rpds-py/test.sh b/lang/python/python-rpds-py/test.sh new file mode 100644 index 000000000..d5dec8f5f --- /dev/null +++ b/lang/python/python-rpds-py/test.sh @@ -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 |
