Skip to content

Commit c62abff

Browse files
knedlseppJosef Kemetmüllerweibullguy
authored
Handle abbreviation 'etc.' (et cetera) (#273)
(Also add a missed comma in the test parametrization) Co-authored-by: Josef Kemetmüller <[email protected]> Co-authored-by: Doyle Rowland <[email protected]>
1 parent 3f92ff6 commit c62abff

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/docformatter/strings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def split_first_sentence(text):
183183

184184
sentence += previous_delimiter + word
185185

186-
if sentence.endswith(("e.g.", "i.e.", "Dr.", "Mr.", "Mrs.", "Ms.")):
186+
if sentence.endswith(("e.g.", "i.e.", "etc.", "Dr.", "Mr.", "Mrs.", "Ms.")):
187187
# Ignore false end of sentence.
188188
pass
189189
elif sentence.endswith((".", "?", "!")):

tests/test_string_functions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,9 @@ def test_split_summary_and_description_without_punctuation(self):
453453
def test_split_summary_and_description_with_abbreviation(self):
454454
""""""
455455
for text in [
456-
"Test e.g. now" "Test i.e. now",
456+
"Test e.g. now",
457+
"Test foo, bar, etc. now",
458+
"Test i.e. now",
457459
"Test Dr. now",
458460
"Test Mr. now",
459461
"Test Mrs. now",

0 commit comments

Comments
 (0)