@@ -122,6 +122,32 @@ def test_conventional_types__custom():
122122 assert set (["custom" , * format .CONVENTIONAL_TYPES ]) == set (result )
123123
124124
125+ def test_r_comment_single ():
126+ regex = re .compile (format .r_comment ())
127+ assert regex .match ("# Some comment" )
128+ assert not regex .match ("Some comment" )
129+ assert not regex .match (" # Some comment" )
130+
131+
132+ def test_strip_comments__consecutive ():
133+ input = """feat(scope): message
134+ # Please enter the commit message for your changes.
135+ # These are comments usually added by editors, f.ex. with export EDITOR=vim
136+ """
137+ result = format .strip_comments (input )
138+ assert result .count ("\n " ) == 1
139+
140+
141+ def test_strip_comments__spaced ():
142+ input = """feat(scope): message
143+ # Please enter the commit message for your changes.
144+
145+ # These are comments usually added by editors, f.ex. with export EDITOR=vim
146+ """
147+ result = format .strip_comments (input )
148+ assert result .count ("\n " ) == 2
149+
150+
125151@pytest .mark .parametrize ("type" , format .DEFAULT_TYPES )
126152def test_is_conventional__default_type (type ):
127153 input = f"{ type } : message"
@@ -198,6 +224,14 @@ def test_is_conventional__bad_body_multiline_paragraphs():
198224 assert not format .is_conventional (input )
199225
200226
227+ def test_is_conventional__comment ():
228+ input = """feat(scope): message
229+ # Please enter the commit message for your changes.
230+ # These are comments usually added by editors, f.ex. with export EDITOR=vim
231+ """
232+ assert format .is_conventional (input )
233+
234+
201235@pytest .mark .parametrize ("char" , ['"' , "'" , "`" , "#" , "&" ])
202236def test_is_conventional__body_special_char (char ):
203237 input = f"feat: message with { char } "
0 commit comments