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
def test_make_copyright_line_multine_error(): """Given a multiline arguement, expect an error.""" with pytest.raises(RuntimeError): _util.make_copyright_line("hello\nworld")
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" )
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
def test_make_copyright_line_simple(): """Given a simple statement, make it a copyright line.""" assert ( _util.make_copyright_line("hello") == "SPDX" "-FileCopyrightText: hello" )
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"
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"
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"
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"