Skip to content

Commit 81e99bf

Browse files
Add tests
1 parent 3001a57 commit 81e99bf

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,27 @@ def test_in_local_variable():
8585
else:
8686
ensure_tainted(ts) # $ tainted
8787

88+
def test_is_none():
89+
ts = TAINTED_STRING
90+
if ts is None:
91+
ensure_not_tainted(ts)
92+
else:
93+
ensure_tainted(ts) # $ tainted
94+
95+
def test_is_not_none():
96+
ts = TAINTED_STRING
97+
if ts is not None:
98+
ensure_tainted(ts) # $ tainted
99+
else:
100+
ensure_not_tainted(ts)
101+
102+
def test_in_list_with_constants():
103+
ts = TAINTED_STRING
104+
if ts in ["safe", None, 3, False]:
105+
ensure_not_tainted(ts)
106+
else:
107+
ensure_tainted(ts) # $ tainted
108+
88109

89110
SAFE = ["safe", "also_safe"]
90111

@@ -184,6 +205,9 @@ def test_eq_thorugh_func():
184205
test_in_set()
185206
test_in_local_variable()
186207
test_in_global_variable()
208+
test_is_none()
209+
test_is_not_none()
210+
test_in_list_with_constants()
187211
make_modification("unsafe")
188212
test_in_modified_global_variable()
189213
test_in_unsafe1(["unsafe", "foo"])

0 commit comments

Comments
 (0)