@@ -123,6 +123,34 @@ def test_conventional_types__custom():
123123 assert set (["custom" , * format .CONVENTIONAL_TYPES ]) == set (result )
124124
125125
126+ def test_r_comment_single ():
127+ regex = re .compile (format .r_comment ())
128+ assert regex .match ("# Some comment" )
129+ assert not regex .match ("Some comment" )
130+ assert not regex .match (" # Some comment" )
131+
132+
133+ def test_strip_comments__consecutive ():
134+ input = """feat(scope): message
135+ # Please enter the commit message for your changes.
136+ # These are comments usually added by editors, f.ex. with export EDITOR=vim
137+ """
138+ result = format .strip_comments (input )
139+ assert result .count ("\n " ) == 1
140+ assert result .strip () == "feat(scope): message"
141+
142+
143+ def test_strip_comments__spaced ():
144+ input = """feat(scope): message
145+ # Please enter the commit message for your changes.
146+
147+ # These are comments usually added by editors, f.ex. with export EDITOR=vim
148+ """
149+ result = format .strip_comments (input )
150+ assert result .count ("\n " ) == 2
151+ assert result .strip () == "feat(scope): message"
152+
153+
126154@pytest .mark .parametrize ("type" , format .DEFAULT_TYPES )
127155def test_is_conventional__default_type (type ):
128156 input = f"{ type } : message"
@@ -199,6 +227,14 @@ def test_is_conventional__bad_body_multiline_paragraphs():
199227 assert not format .is_conventional (input )
200228
201229
230+ def test_is_conventional__comment ():
231+ input = """feat(scope): message
232+ # Please enter the commit message for your changes.
233+ # These are comments usually added by editors, f.ex. with export EDITOR=vim
234+ """
235+ assert format .is_conventional (input )
236+
237+
202238@pytest .mark .parametrize ("char" , ['"' , "'" , "`" , "#" , "&" ])
203239def test_is_conventional__body_special_char (char ):
204240 input = f"feat: message with { char } "
0 commit comments