Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/cluecode/copyrights.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment thread
levi42x marked this conversation as resolved.
Outdated
.replace('[C]', '(c)')
.replace('[c]', '(c)')

.replace('( C)', ' (c) ')
.replace('(C)', ' (c) ')
.replace('(c)', ' (c) ')
Expand Down
10 changes: 10 additions & 0 deletions tests/cluecode/test_copyrights_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Comment thread
levi42x marked this conversation as resolved.
Outdated
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)
Expand Down