Skip to content

Conversation

@tiya-9975
Copy link

Checklist:

  • I have read freeCodeCamp's contribution guidelines.
  • My pull request has a descriptive title.

Closes #1121

Adds documentation explaining how to assert the absence of function calls using the Python AST helper. This helps curriculum authors enforce removal of statements such as print().

@tiya-9975 tiya-9975 requested a review from a team as a code owner January 19, 2026 11:12
@tiya-9975
Copy link
Author

Hi, the CI failure seems unrelated to the docs change.

It fails due to Node engine mismatch (Node 22 vs required Node 24):
ERR_PNPM_UNSUPPORTED_ENGINE — Expected >=24.12.0, got 22.21.1

I see Node 24 was recently fixed in #1127, so a re-run of CI should pass.

Thank you!

@Satishchoudhary94
Copy link
Contributor

Yes, the failure is due to Node 22 being used while the dependency requires >=24.12.0. Since Node 24 support was aligned in #1127, a CI re-run should pick up the correct version and pass.

@majestic-owl448
Copy link
Contributor

majestic-owl448 commented Jan 19, 2026

restarting the tests does not work, I updated the branch

@tiya-9975
Copy link
Author

I have updated my branch with upstream main (Node 24) and formatted the file using Prettier.
CI should now pass. Thank you!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do not make changes to dependencies in a PR to add info to the docs, dependency updates if needed go in a different PR

if you are trying to do multiple contributions, this is why it's highly suggested to not make PRs from the main branch

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the guidance. I’ve reverted all dependency and CI changes and kept this PR docs-only as suggested.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

files package.json and pnpm-lock.yaml are still in the PR

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your patience. I’ve now rewritten the branch so this PR contains only the documentation change and no dependency files.

To assert that a function call does not exist in the learner’s code, simply negate the helper result:

```python
assert not Node(code).has_call("print")
Copy link
Contributor

@Dario-DC Dario-DC Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has_call requires the exact call including arguments. So this should at least include parenthesis -> has_call('print()')

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for pointing that out. I’ve updated the examples to use has_call("print()") and block_has_call("print()") as required by the helper.


```python
assert not Node(code).has_call("print()")
assert not Node(code).block_has_call("print()")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

block_has_call does not require the literal call

Suggested change
assert not Node(code).block_has_call("print()")
assert not Node(code).block_has_call("print")

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification. I’ve updated the example so has_call uses "print()" and block_has_call uses "print" as suggested.

@tiya-9975
Copy link
Author

Thanks for the detailed reviews and clarifications.

I’ve updated the examples so that:

has_call uses the literal call form ("print()")

block_has_call uses the non-literal form ("print") as intended

The PR is now docs-only, with no dependency or CI changes, and all checks are passing.

Please let me know if anything else needs adjustment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update fCC curriculum-help page to clarify how to assert absence of function calls using Python AST helper.

5 participants