예제 #1
0
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
예제 #2
0
def test_create_comment_python():
    """Create a simple Python comment."""
    text = cleandoc("""
        Hello

        world
        """)
    expected = cleandoc("""
        # Hello
        #
        # world
        """)

    assert PythonCommentStyle.create_comment(text) == expected
예제 #3
0
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)
예제 #4
0
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