Skip to content

Commit 15476c2

Browse files
committed
Python: Add data-flow tests for BoolExp
> 6.11. Boolean operations > The expression x and y first evaluates x; if x is false, its value is > returned; otherwise, y is evaluated and the resulting value is > returned. > The expression x or y first evaluates x; if x is true, its value is > returned; otherwise, y is evaluated and the resulting value is > returned.
1 parent 2539e32 commit 15476c2

File tree

1 file changed

+12
-0
lines changed
  • python/ql/test/experimental/dataflow/coverage

1 file changed

+12
-0
lines changed

python/ql/test/experimental/dataflow/coverage/test.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,18 @@ def test_call_extra_keyword_flow():
422422
SINK(f_extra_keyword_flow(**{SOURCE: None})) #$ MISSING:flow="SOURCE -> f_extra_keyword(..)"
423423

424424

425+
# 6.11. Boolean operations
426+
427+
def test_or(x = False):
428+
# if we don't know the value of the lhs, we should always add flow
429+
SINK(x or SOURCE) #$ MISSING: flow="SOURCE -> BoolExp"
430+
431+
432+
def test_and(x = True):
433+
# if we don't know the value of the lhs, we should always add flow
434+
SINK(x and SOURCE) #$ MISSING: flow="SOURCE -> BoolExp"
435+
436+
425437
# 6.12. Assignment expressions
426438
def test_assignment_expression():
427439
x = NONSOURCE

0 commit comments

Comments
 (0)