Exemple #1
0
def test_filter_ignore_block_with_multiple_ignore_blocks():
    """Test that the ignore block is properly removed if it has relevant
    information on the same line.
    """
    text = cleandoc("""
        Relevant text
        REUSE-IgnoreStart
        Ignored text
        REUSE-IgnoreEnd
        Other relevant text
        REUSE-IgnoreStart
        Other ignored text
        REUSE-IgnoreEnd
        Even more relevant text
        """)
    expected = cleandoc("""
        Relevant text

        Other relevant text

        Even more relevant text
        """)

    result = _util.filter_ignore_block(text)
    assert result == expected
Exemple #2
0
def test_filter_ignore_block_with_beginning_and_end_on_same_line_wrong_order():
    """Test that the ignore block is properly removed if it has relevant
    information on the same line.
    """
    text = "Relevant textREUSE-IgnoreEndOther relevant textREUSE-IgnoreStartIgnored text"  # pylint: disable=line-too-long
    expected = "Relevant textREUSE-IgnoreEndOther relevant text"

    result = _util.filter_ignore_block(text)
    assert result == expected
Exemple #3
0
def test_filter_ignore_block_without_end():
    """Test that the ignore block is properly removed if it has relevant
    information on the same line.
    """
    text = cleandoc("""
        Relevant text
        REUSE-IgnoreStart
        Ignored text
        Other ignored text
        """)
    expected = "Relevant text\n"

    result = _util.filter_ignore_block(text)
    assert result == expected
Exemple #4
0
def test_filter_ignore_block_with_comment_style():
    """Test that the ignore block is properly removed if start and end markers
    are in comment style.
    """
    text = cleandoc("""
        Relevant text
        # REUSE-IgnoreStart
        Ignored text
        # REUSE-IgnoreEnd
        Other relevant text
        """)
    expected = "Relevant text\n# \nOther relevant text"

    result = _util.filter_ignore_block(text)
    assert result == expected
Exemple #5
0
def test_filter_ignore_block_with_ignored_information_on_same_line():
    """Test that the ignore block is properly removed if there is information to
    be ignored on the same line.
    """
    text = cleandoc("""
        Relevant text
        REUSE-IgnoreStart Copyright me
        Ignored text
        sdojfsdREUSE-IgnoreEnd
        Other relevant text
        """)
    expected = cleandoc("""
        Relevant text

        Other relevant text
        """)

    result = _util.filter_ignore_block(text)
    assert result == expected