def test_create_comment_python_dont_strip_newlines(): """Include newlines in the comment.""" text = "\nhello\n" expected = cleandoc(""" # # hello # """) assert PythonCommentStyle.create_comment(text) == expected
def test_create_comment_python(): """Create a simple Python comment.""" text = cleandoc(""" Hello world """) expected = cleandoc(""" # Hello # # world """) assert PythonCommentStyle.create_comment(text) == expected
def test_create_comment_python_force_multi(): """Raise CommentCreateError when creating a multi-line Python comment.""" with pytest.raises(CommentCreateError): PythonCommentStyle.create_comment("hello", force_multi=True)
def test_create_comment_python_strip_newlines(): """Don't include unnecessary newlines in the comment.""" text = "\nhello\n" expected = "# hello" assert PythonCommentStyle.create_comment(text) == expected