Repository navigation
feat: add roman command to convert numbers and Roman numerals (#91) - #126
Closed
KentSimon07 wants to merge 2 commits into
Closed
KentSimon07 wants to merge 2 commits into
KentSimon07 wants to merge 2 commits into
Conversation
Contributor
Author
|
Hi @codepiyusss, I've finished this one: the roman command, validation and 11 tests, all passing. Ready for review whenever you have time. Could you assign me to #91? Thanks! |
Owner
|
Thanks for the contribution @KentSimon07 , this PR currently isn’t in a mergeable state. There are two blockers:
Please fix the merge conflicts, address the failing CI/Ruff issues, and re-run the validation locally before submitting the PR again. Once the workflow checks pass and the conflict is resolved, we can review the feature again. If you want, a good next step is to run:
After that, push the updated branch and open a new PR if needed. |
4 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds a
fixit romancommand that converts between numbers and Roman numerals. The direction is decided from the input: digits are converted to a numeral, anything else is parsed as a numeral.fixit/roman.pywith two pure functions (no printing):to_roman(number): converts 1–3999 using a greedy lookup over the 13 symbol values (including subtractive pairs like CM, XC, IV)from_roman(numeral): parses a numeral (case-insensitive), then validates it with a round-trip check (to_roman(result)must equal the input), which rejects malformed numerals such asIIII,VXandICValueErrorfor invalid input, somain()prints a friendly one-line error and exits with code 1fixit/cli.py: added theromansubparser andrun_roman, registered inCOMMAND_TABLElike the existing commandsExample usage:
Related issue
Closes #91
Checklist
xfailmarker (if fixing a bug) (N/A, this is a new feature)tests/test_roman.py(normal values, boundaries 1/3999/0/4000, lowercase, and invalid numerals)pytestpasses locally: 50 passed