def test_create_comment_c_multi_contains_ending(): """Raise CommentCreateError when the text contains a comment ending.""" text = cleandoc(""" Hello world */ """) with pytest.raises(CommentCreateError): CCommentStyle.create_comment(text, force_multi=True)
def test_create_comment_c_single(): """Create a C comment with single-line comments.""" text = cleandoc(""" Hello world """) expected = cleandoc(""" // Hello // world """) assert CCommentStyle.create_comment(text) == expected
def test_create_comment_c_multi_surrounded_by_newlines(): """Create a C comment that is surrounded by empty lines.""" text = "\nHello\nworld\n" expected = cleandoc(""" /* * * Hello * world * */ """) assert CCommentStyle.create_comment(text, force_multi=True) == expected
def test_create_comment_c_multi(): """Create a C comment with multi-line comments.""" text = cleandoc(""" Hello world """) expected = cleandoc(""" /* * Hello * world */ """) assert CCommentStyle.create_comment(text, force_multi=True) == expected
def test_create_comment_c_multi_empty_newlines(): """Create a C comment that contains empty lines.""" text = cleandoc(""" Hello world """) expected = cleandoc(""" /* * Hello * * world */ """) assert CCommentStyle.create_comment(text, force_multi=True) == expected