Skip to content
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 pydocstringformatter/_formatting/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def treat_token(self, tokeninfo: tokenize.TokenInfo) -> tokenize.TokenInfo:
class StringAndQuotesFormatter(Formatter):
"""Base class for string formatter that needs access to the quotes."""

quotes_regex = re.compile(r"""['"]{1,3}""")
quotes_regex = re.compile(r"""^('{3}|'|"{3}|")""")
"""Pattern to match against opening quotes."""

@abc.abstractmethod
Expand Down
11 changes: 11 additions & 0 deletions tests/data/format/quotes_type/mix_with_double_at_start.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def a(self):
"'a.m.' or 'p.m.'"

def b(self):
"""'a.m.' or 'p.m.'"""

def c(self):
"'''a.m.''' or 'p.m.'"

def d(self):
"""'''a.m.''' or 'p.m.'"""
11 changes: 11 additions & 0 deletions tests/data/format/quotes_type/mix_with_double_at_start.py.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def a(self):
"""'A.m.' or 'p.m.'."""

def b(self):
"""'a.m.' or 'p.m.'."""

def c(self):
"""'''a.m.''' or 'p.m.'."""

def d(self):
"""'''a.m.''' or 'p.m.'."""
11 changes: 11 additions & 0 deletions tests/data/format/quotes_type/mix_with_single_at_start.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def a(self):
'"a.m." or "p.m."'

def b(self):
'''"a.m." or "p.m."'''

def c(self):
'"""a.m.""" or "p.m."'

def d(self):
'''"""a.m.""" or "p.m."'''
11 changes: 11 additions & 0 deletions tests/data/format/quotes_type/mix_with_single_at_start.py.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def a(self):
""""A.m." or "p.m."."""

def b(self):
""""a.m." or "p.m."."""

def c(self):
""""""a.m.""" or "p.m."."""

def d(self):
""""""a.m.""" or "p.m."."""