Skip to content

Commit ff959c6

Browse files
docs: clarify how to assert absence of function calls using Python AST helper (#1130)
Co-authored-by: DarshCode123 <[email protected]>
1 parent 43336e7 commit ff959c6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/content/docs/curriculum-help.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,17 @@ node.block_has_call("get") # True
15311531
node.block_has_call("split") # False
15321532
```
15331533

1534+
### Asserting absence of a function call
1535+
1536+
Sometimes a challenge requires learners to remove a specific statement, such as a `print()` call.
1537+
1538+
To assert that a function call does not exist in the learner’s code, simply negate the helper result:
1539+
1540+
```python
1541+
assert not Node(code).has_call("print()")
1542+
assert not Node(code).block_has_call("print")
1543+
```
1544+
15341545
#### `has_import()`
15351546

15361547
```python

0 commit comments

Comments
 (0)