def test_prepare_text(self): tests = [ '* SPDX-License-Identifier: (BSD-3-Clause OR EPL-1.0 OR Apache-2.0 OR MIT)', '* SPDX-License-Identifier: BSD-3-Clause ', '// SPDX-License-Identifier: BSD-3-Clause (', '# SPDX-License-Identifier: BSD-3-Clause', '/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */', '* SPDX-License-Identifier: GPL-2.0+', '* SPDX-License-Identifier: GPL-2.0', '; SPDX-License-Identifier: GPL-2.0', ';;; SPDX-License-Identifier: GPL-2.0', '! SPDX-License-Identifier: GPL-2.0', '// SPDX-License-Identifier: GPL-2.0+', '/* SPDX-License-Identifier: GPL-2.0+ */', '* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause )', '(/ SPDX-Licence--Identifier: (GPL-2.0 OR BSD-3-Clause)', '// SPDX-License-Identifier: LGPL-2.1+', '+SPDX-License-Identifier: GPL-2.0+', '* SPDX-License-Identifier: GPL-2.0+ BSD-2-Clause', '// SPDX Licence Identifier LGPL-2.1+', ] expected = [ ('SPDX-License-Identifier:', '(BSD-3-Clause OR EPL-1.0 OR Apache-2.0 OR MIT)'), ('SPDX-License-Identifier:', 'BSD-3-Clause'), ('SPDX-License-Identifier:', 'BSD-3-Clause'), ('SPDX-License-Identifier:', 'BSD-3-Clause'), ('SPDX-License-Identifier:', 'GPL-1.0+ WITH Linux-syscall-note'), ('SPDX-License-Identifier:', 'GPL-2.0+'), ('SPDX-License-Identifier:', 'GPL-2.0'), ('SPDX-License-Identifier:', 'GPL-2.0'), ('SPDX-License-Identifier:', 'GPL-2.0'), ('SPDX-License-Identifier:', 'GPL-2.0'), ('SPDX-License-Identifier:', 'GPL-2.0+'), ('SPDX-License-Identifier:', 'GPL-2.0+'), ('SPDX-License-Identifier:', '(GPL-2.0+ OR BSD-3-Clause )'), ('SPDX-Licence--Identifier:', '(GPL-2.0 OR BSD-3-Clause)'), ('SPDX-License-Identifier:', 'LGPL-2.1+'), ('SPDX-License-Identifier:', 'GPL-2.0+'), ('SPDX-License-Identifier:', 'GPL-2.0+ BSD-2-Clause'), ('SPDX Licence Identifier', 'LGPL-2.1+') ] results = [prepare_text(test) for test in tests] assert expected == results
def test_prepare_text_with_rem(self): assert prepare_text('') == (None, '') assert prepare_text('@REM # SPDX-License-Identifier: BSD-2-Clause-Patent') == ('SPDX-License-Identifier:', 'BSD-2-Clause-Patent')
def test_prepare_text_with_rem(self): assert '' == prepare_text('') assert 'BSD-2-Clause-Patent' == prepare_text('@REM # SPDX-License-Identifier: BSD-2-Clause-Patent')