File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ Basic usage:
1616
1717``` python
1818from cel import evaluate
19+
1920expression = " age > 21"
2021result = evaluate(expression, {" age" : 18 })
2122print (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
Original file line number Diff line number Diff 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+
4852def test_timestamp_context_without_timezone ():
4953 now = datetime .datetime .now ()
5054 assert cel .evaluate ("now" , {'now' : now })
You can’t perform that action at this time.
0 commit comments