Exemple #1
0
def test_make_copyright_line_existing_other_copyright():
    """Given a non-SPDX copyright line, do nothing."""
    value = "© hello"
    assert _util.make_copyright_line(value) == value
Exemple #2
0
def test_make_copyright_line_multine_error():
    """Given a multiline arguement, expect an error."""
    with pytest.raises(RuntimeError):
        _util.make_copyright_line("hello\nworld")
Exemple #3
0
def test_make_copyright_line_year():
    """Given a simple statement and a year, make it a copyright line."""
    assert (
        _util.make_copyright_line("hello", year="2019") == "SPDX"
        "-FileCopyrightText: 2019 hello"
    )
Exemple #4
0
def test_make_copyright_line_existing_spdx_copyright():
    """Given a copyright line, do nothing."""
    value = "SPDX" "-FileCopyrightText: hello"
    assert _util.make_copyright_line(value) == value
Exemple #5
0
def test_make_copyright_line_simple():
    """Given a simple statement, make it a copyright line."""
    assert (
        _util.make_copyright_line("hello") == "SPDX"
        "-FileCopyrightText: hello"
    )
Exemple #6
0
def test_make_copyright_line_style_symbol_year():
    """Given a simple statement, style and a year, make it a copyright line."""
    statement = _util.make_copyright_line("hello",
                                          year=2019,
                                          copyright_style="symbol")
    assert statement == "© 2019 hello"
Exemple #7
0
def test_make_copyright_line_style_string_c_year():
    """Given a simple statement, style and a year, make it a copyright line."""
    statement = _util.make_copyright_line("hello",
                                          year=2019,
                                          copyright_style="string-c")
    assert statement == "Copyright (C) 2019 hello"
Exemple #8
0
def test_make_copyright_line_style_spdx_year():
    """Given a simple statement, style and a year, make it a copyright line."""
    statement = _util.make_copyright_line("hello",
                                          year=2019,
                                          copyright_style="spdx")
    assert statement == "SPDX-FileCopyrightText: 2019 hello"
Exemple #9
0
def test_make_copyright_line_style_spdx():
    """Given a simple statement and style, make it a copyright line."""
    statement = _util.make_copyright_line("hello", copyright_style="spdx")
    assert statement == "SPDX-FileCopyrightText: hello"