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
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/docformatter/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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((".", "?", "!")):
Expand Down
4 changes: 3 additions & 1 deletion tests/test_string_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading