Skip to content

Commit

Permalink
Added tests for manipulating dict and list
Browse files Browse the repository at this point in the history
  • Loading branch information
AryazE committed Mar 27, 2024
1 parent 58d52f4 commit 7a8f459
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/manipulate_single_hook/literal/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ def literal(self, dyn_ast: str, iid: int, val: Any) -> Any:
print(f"literal hook called: {val}")
if val == 5:
return "abc"
if isinstance(val, dict):
return "abc"
if isinstance(val, list):
return "abc"
11 changes: 11 additions & 0 deletions tests/manipulate_single_hook/literal/expected.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
literal hook called: 5
literal hook called: 99
abc
literal hook called: a
literal hook called: 1
literal hook called: b
literal hook called: 2
literal hook called: {'a': 1, 'b': 2}
abc
literal hook called: 1
literal hook called: 2
literal hook called: 3
literal hook called: [1, 2, 3]
abc
4 changes: 4 additions & 0 deletions tests/manipulate_single_hook/literal/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ class Object(object):
obj.b = 99
x = obj.a
print(x)
a = {"a": 1, "b": 2}
print(a)
b = [1, 2, 3]
print(b)

0 comments on commit 7a8f459

Please sign in to comment.