Files
packages/lang/python/python-outcome/test.sh
Alexandru Ardelean 1158559cef python-outcome: update to 1.3.0
Update package to 1.3.0.

Changes since 1.2.0:

1.3.0:
- Added full type hints; Value and Outcome are now generic classes
- Added Maybe type alias as a union of Value[T] and Error
- Added typed __all__ exports and marked __version__ as a public constant
- Functions that do not return are now captured as Error
- Added pyright --verifytypes to CI; strict mypy mode enabled

Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
2026-04-16 07:08:59 +03:00

34 lines
741 B
Bash
Executable File

#!/bin/sh
[ "$1" = python3-outcome ] || exit 0
python3 - << 'EOF'
from outcome import Value, Error, capture, acapture
# Value outcome
v = Value(42)
assert v.value == 42
assert v.unwrap() == 42
# Error outcome
e = Error(ValueError("oops"))
assert isinstance(e.error, ValueError)
try:
e.unwrap()
assert False, "Should have raised"
except ValueError as exc:
assert str(exc) == "oops"
# capture()
result = capture(lambda: 1 + 1)
assert isinstance(result, Value)
assert result.value == 2
result2 = capture(lambda: 1 / 0)
assert isinstance(result2, Error)
assert isinstance(result2.error, ZeroDivisionError)
# acapture is present and callable (async test omitted: python3-asyncio not a dependency)
assert callable(acapture)
EOF