Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle abbreviation 'etc.' (et cetera) #273

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Handle abbreviation 'etc.' (et cetera)
(Also add a missed comma in the test parametrization)
Josef Kemetmüller committed Jan 9, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 61f6649fce34b70c28c8e2147b1f19302399a823
2 changes: 1 addition & 1 deletion src/docformatter/strings.py
Original file line number Diff line number Diff line change
@@ -183,7 +183,7 @@ def split_first_sentence(text):

sentence += previous_delimiter + word

if sentence.endswith(("e.g.", "i.e.", "Dr.", "Mr.", "Mrs.", "Ms.")):
if sentence.endswith(("e.g.", "i.e.", "etc.", "Dr.", "Mr.", "Mrs.", "Ms.")):
# Ignore false end of sentence.
pass
elif sentence.endswith((".", "?", "!")):
4 changes: 3 additions & 1 deletion tests/test_string_functions.py
Original file line number Diff line number Diff line change
@@ -453,7 +453,9 @@ def test_split_summary_and_description_without_punctuation(self):
def test_split_summary_and_description_with_abbreviation(self):
""""""
for text in [
"Test e.g. now" "Test i.e. now",
"Test e.g. now",
"Test foo, bar, etc. now",
"Test i.e. now",
"Test Dr. now",
"Test Mr. now",
"Test Mrs. now",