def test_count_comments():
    """ check all comments are caught """
    singleline_comments = pc.list_singleline_java_comments(JAVA_SOURCE)
    multiline_comments = pc.list_multiline_java_comments(JAVA_SOURCE)
    javadoc_comments = pc.list_javadoc_comments(JAVA_SOURCE)
    assert len(singleline_comments) == 13
    assert len(multiline_comments) == 6
    assert len(javadoc_comments) == 1
def test_get_all_comments():
    """ check that destructured get_all_comments parts are correct """
    singleline_comments = pc.list_singleline_java_comments(JAVA_SOURCE)
    multiline_comments = pc.list_multiline_java_comments(JAVA_SOURCE)
    javadoc_comments = pc.list_javadoc_comments(JAVA_SOURCE)
    assert pc.get_all_comments([JAVA_SOURCE]) == (
        singleline_comments,
        multiline_comments,
        javadoc_comments)
def test_comment_space_indented_bol():
    """ BOL comment indented with spaces """
    comments = pc.list_singleline_java_comments(JAVA_SOURCE)
    assert "comment_3" in comments
    assert "comment_4" in comments
    assert "comment_5" in comments
    assert "comment_6" in comments
    assert "comment_7" in comments
    assert "comment_8" in comments
    assert "comment_9" in comments
def test_quoted_comment():
    """ comment within quoted string """
    comments = pc.list_singleline_java_comments(JAVA_SOURCE)
    assert "comment_14" not in comments
def test_comment_eol():
    """ comment at end-of-line """
    comments = pc.list_singleline_java_comments(JAVA_SOURCE)
    assert "comment_11" in comments
    assert "comment_12" in comments
    assert "comment_13" in comments
def test_comment_tab_indented_bol():
    """ BOL comment indented with tabs """
    comments = pc.list_singleline_java_comments(JAVA_SOURCE)
    assert "comment_10_tab" in comments
def test_comment_bol():
    """ comment at beginning-of-line """
    comments = pc.list_singleline_java_comments(JAVA_SOURCE)
    assert "comment_1" in comments
    assert "comment_2" in comments
def test_javadoc_comments():
    """ check that javadoc comments are caught """
    assert "javadoc" not in pc.list_multiline_java_comments(JAVA_SOURCE)
    assert "javadoc" not in pc.list_singleline_java_comments(JAVA_SOURCE)
    assert "javadoc" in pc.list_javadoc_comments(JAVA_SOURCE)