Skip to content

Raise ValueError for invalid A1Z26 input#14974

Open
bengokaysaglam wants to merge 1 commit into
TheAlgorithms:masterfrom
bengokaysaglam:fix/a1z26-input-validation
Open

Raise ValueError for invalid A1Z26 input#14974
bengokaysaglam wants to merge 1 commit into
TheAlgorithms:masterfrom
bengokaysaglam:fix/a1z26-input-validation

Conversation

@bengokaysaglam

Copy link
Copy Markdown

Describe your change

  • Fix a bug in an existing algorithm.

Summary

This PR adds input validation to the A1Z26 encoder.

Changes:

  • Raise ValueError for empty input.
  • Reject characters outside a-z.
  • Add doctests for invalid input cases.

All doctests pass successfully.

@algorithms-keeper algorithms-keeper Bot added enhancement This PR modified some existing files awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass labels Jul 26, 2026
@bengokaysaglam
bengokaysaglam force-pushed the fix/a1z26-input-validation branch from 1efafc3 to 1c2704e Compare July 26, 2026 09:31
@bengokaysaglam

Copy link
Copy Markdown
Author

Hi! I noticed that the remaining failing Ruff check is caused by unrelated files, as ciphers/a1z26.py is no longer reported. The doctests for my changes pass locally, and the pre-commit checks are now successful. Please let me know if there's anything else I should update. Thanks!

@FahedKaddou

Copy link
Copy Markdown

AI Code Review (PR Review Agent)

  • [Performance · Medium]ciphers/a1z26.py (diff line 33): The input string 'plain' is iterated over twice: once for validation and once for transformation, leading to redundant work.

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

Labels

awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files tests are failing Do not merge until tests pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants