diff --git a/src/cluecode/copyrights.py b/src/cluecode/copyrights.py index 8272135955f..3f3031a363e 100644 --- a/src/cluecode/copyrights.py +++ b/src/cluecode/copyrights.py @@ -4502,6 +4502,11 @@ def prepare_text_line(line): # normalize copyright signs, quotes and spacing around them .replace('"Copyright', '" Copyright') + + # normalize [C] and [c] to (c) before bracket removal + .replace('[C]', '(c)') + .replace('[c]', '(c)') + .replace('( C)', ' (c) ') .replace('(C)', ' (c) ') .replace('(c)', ' (c) ') diff --git a/tests/cluecode/test_copyrights_basic.py b/tests/cluecode/test_copyrights_basic.py index 23408ea643b..6e5dc8cf605 100644 --- a/tests/cluecode/test_copyrights_basic.py +++ b/tests/cluecode/test_copyrights_basic.py @@ -68,6 +68,16 @@ def test_prepare_text_line_does_not_damage_urls(self): result = prepare_text_line(cp) assert result == 'copyright (c) 2000 World Wide Web Consortium, http://www.w3.org' + def test_prepare_text_line_normalizes_bracket_C_uppercase(self): + cp = '[C] The Regents of the University of Michigan and Merit Network, Inc. 1992, 1993, 1994, 1995 All Rights Reserved' + result = prepare_text_line(cp) + assert result == '(c) The Regents of the University of Michigan and Merit Network, Inc. 1992, 1993, 1994, 1995 All Rights Reserved' + + def test_prepare_text_line_normalizes_bracket_c_lowercase(self): + cp = 'Copyright [c] 2023 Example Company' + result = prepare_text_line(cp) + assert result == 'Copyright (c) 2023 Example Company' + def test_prepare_text_line_does_replace_copyright_signs(self): cp = 'Copyright \\A9 1991, 1999 Free Software Foundation, Inc.' result = prepare_text_line(cp)