Files
packages/lang/python/python-pyparsing/test.sh
Alexandru Ardelean 68d15d9821 python-pyparsing: bump to 3.3.2
pyparsing also requires the 'unittest' module from the Python3 package.

Changelog: https://github.com/pyparsing/pyparsing/blob/master/CHANGES
Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
2026-04-03 09:38:08 +03:00

31 lines
592 B
Bash
Executable File

#!/bin/sh
[ "$1" = python3-pyparsing ] || exit 0
python3 - << 'EOF'
import pyparsing as pp
# Basic word and integer parsing
word = pp.Word(pp.alphas)
integer = pp.Word(pp.nums)
result = word.parse_string("hello")
assert result[0] == "hello"
result = integer.parse_string("42")
assert result[0] == "42"
# Combined expression
greeting = word + pp.Literal(",") + word
result = greeting.parse_string("Hello, World")
assert result[0] == "Hello"
assert result[2] == "World"
# OneOf
colors = pp.one_of("red green blue")
result = colors.parse_string("green")
assert result[0] == "green"
EOF