Avoid a serial comma when joining only two items - #84
Open
oyeong011 wants to merge 1 commit into
Open
Conversation
A serial comma separates the penultimate item only in lists of at least three items. Check the remaining count after popping the final item. Confidence: high Scope-risk: narrow Tested: 67 isolated tests pass; affected text tests and large generator API calls pass; flake8 passes Not-tested: Two pre-existing macOS capture tests time out identically on baseline
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.
Fixes #63.
concatenate(['foo', 'bar'], serial_comma=True)currently returnsfoo, and bar. A serial comma applies to lists of three or more items. Check the remaining item count after popping the final item, so two-item lists producefoo and bar.Regression checks cover empty, single-item, two-item, three-item, custom-conjunction, and iterator inputs.
Validation: the affected text tests pass, flake8 passes, and real API checks pass with up to 10,000 items. Running all tests in isolated processes on Python 3.11/macOS gives 67 passes and two timeouts (
test_generate_warning,test_terminal_capabilities); the unmodified base gives the identical result. The standard captured pytest run is also blocked by these existing capture interactions. Historical Python versions were not tested.AI disclosure: this patch and its tests were prepared with OpenAI Codex and verified by executing the tests and public APIs.