summaryrefslogtreecommitdiff
path: root/lang/python/python-constantly/test.sh
diff options
context:
space:
mode:
authorJeffery To <jeffery.to@gmail.com>2023-10-31 11:43:33 +0800
committerTianling Shen <cnsztl@gmail.com>2023-11-02 00:27:11 +0800
commit1fbe4b9a8b60ac22759e45845518d3e0d4fe35af (patch)
treecd27526c2347efa628dee47b018d1e04b60f552a /lang/python/python-constantly/test.sh
parent8acd006b6e0d679fa60e5cdf263b90e940c6ccef (diff)
python-constantly: Update to 23.10.4, add new build dependency
This also adds a test.sh script for the packages feed CI. Signed-off-by: Jeffery To <jeffery.to@gmail.com>
Diffstat (limited to 'lang/python/python-constantly/test.sh')
-rw-r--r--lang/python/python-constantly/test.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/lang/python/python-constantly/test.sh b/lang/python/python-constantly/test.sh
new file mode 100644
index 000000000..d6b367ccf
--- /dev/null
+++ b/lang/python/python-constantly/test.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+[ "$1" = python3-constantly ] || exit 0
+
+python3 - << 'EOF'
+
+from constantly import NamedConstant, Names
+class Letters(Names):
+ a = NamedConstant()
+ b = NamedConstant()
+ c = NamedConstant()
+
+assert Letters.lookupByName('a') is Letters.a
+assert Letters.a < Letters.b
+assert Letters.b < Letters.c
+assert Letters.a < Letters.c
+
+from constantly import ValueConstant, Values
+class STATUS(Values):
+ OK = ValueConstant('200')
+ FOUND = ValueConstant('302')
+ NOT_FOUND = ValueConstant('404')
+
+assert STATUS.OK.value == '200'
+assert STATUS.lookupByValue('404') == STATUS.NOT_FOUND
+
+EOF