Skip to content

Replace fileset production asserts with explicit exceptions - #105

Open
huda-code wants to merge 1 commit into
aboutcode-org:mainfrom
huda-code:fix-fileset-production-assert
Open

huda-code wants to merge 1 commit into
aboutcode-org:mainfrom
huda-code:fix-fileset-production-assert

Conversation

@huda-code

Copy link
Copy Markdown

Contributes to aboutcode-org/aboutcode#175

This PR replaces production assert statements in commoncode/fileset.py with explicit runtime exceptions.

Changes:

  • Replaced assert isinstance(patterns, (list, tuple)) with TypeError
  • Replaced file existence assert with FileNotFoundError
  • Kept pytest/test asserts unchanged

Why:
Production asserts can be skipped when Python is run with optimization flags (-O / -OO). Explicit exceptions ensure runtime validation is preserved consistently.

Tested with:
PYTHONPATH=src python3 -m pytest tests/test_fileset.py

Signed-off-by: HudaHajira <hudahajira744@gmail.com>

This branch has not been deployed

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

Labels

None yet

1 participant