Skip to content

Commit

Permalink
add pop in list test
Browse files Browse the repository at this point in the history
  • Loading branch information
tserg committed Dec 30, 2024
1 parent b43e827 commit 6f2406d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/functional/syntax/test_for_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,21 @@ def test()-> (DynArray[uint256, 6], DynArray[uint256, 10]):
None,
"self.arr.pop() + 2",
),
# Cannot call `pop()` in iterator because it modifies state
(
"""
a: DynArray[uint256, 3]
@external
def foo():
for i: uint256 in [1, 2, self.a.pop()]:
pass
""",
StateAccessViolation,
"May not call state modifying function within a range expression or for loop iterator.",
None,
"self.a.pop()",
),
]

for_code_regex = re.compile(r"for .+ in (.*):", re.DOTALL)
Expand Down

0 comments on commit 6f2406d

Please sign in to comment.