Skip to content

Commit a8c5b1b

Browse files
committed
Update readme
1 parent 82b0f9e commit a8c5b1b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Basic usage:
1616

1717
```python
1818
from cel import evaluate
19+
1920
expression = "age > 21"
2021
result = evaluate(expression, {"age": 18})
2122
print(result) # False
@@ -34,10 +35,10 @@ evaluate(
3435
"claim": {"group": "hardbyte"}
3536
}
3637
)
38+
True
3739
```
3840
## Future work
3941

40-
Support for converting Python datetime objects and timedeltas into CEL types.
4142

4243
### Command line interface
4344

tests/test_basics.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ def test_timestamp_context_with_timezone():
4545
assert cel.evaluate("now", {'now': now}) == now
4646

4747

48+
def test_timestamp_add_duration():
49+
now = datetime.datetime.now(datetime.timezone.utc)
50+
cel.evaluate("start_time + duration('1h')", {'start_time': now}) == now + datetime.timedelta(hours=1)
51+
4852
def test_timestamp_context_without_timezone():
4953
now = datetime.datetime.now()
5054
assert cel.evaluate("now", {'now': now})

0 commit comments

Comments
 (0)