Skip to content

Fix for An assert statement has a side-effect#49

Merged
ondratu merged 1 commit intomasterfrom
finding-autofix-f2af094b
May 5, 2026
Merged

Fix for An assert statement has a side-effect#49
ondratu merged 1 commit intomasterfrom
finding-autofix-f2af094b

Conversation

@ondratu
Copy link
Copy Markdown
Contributor

@ondratu ondratu commented May 5, 2026

To fix this, move side-effecting method calls out of assert expressions and assert on their returned values afterward.

Best fix for this file:

  • In tests/test_digest.py, inside TestMap.test_delete, replace:
    • assert pmap.delete(REALM, USER) is True
    • assert pmap.delete(REALM, USER) is False
  • with:
    • deleted = pmap.delete(REALM, USER) then assert deleted is True
    • deleted_again = pmap.delete(REALM, USER) then assert deleted_again is False

No new imports, methods, or dependencies are required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@ondratu ondratu marked this pull request as ready for review May 5, 2026 16:56
@ondratu ondratu merged commit 53d0a8d into master May 5, 2026
7 checks passed
@ondratu ondratu deleted the finding-autofix-f2af094b branch May 5, 2026 16:57
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.

1 participant