Skip to content

Commit

Permalink
Revert changes to cluecode_test_utils.CopyrightTest
Browse files Browse the repository at this point in the history
    * Do not rename summaries to tallies

Reference: #2842
Signed-off-by: Jono Yang <jyang@nexb.com>
  • Loading branch information
JonoYang committed Apr 19, 2022
1 parent 34720c1 commit e92c8c5
Show file tree
Hide file tree
Showing 3,150 changed files with 3,213 additions and 15,443 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
42 changes: 21 additions & 21 deletions tests/cluecode/cluecode_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ class CopyrightTest(object):
holders = attr.ib(default=attr.Factory(list))
authors = attr.ib(default=attr.Factory(list))

holders_tallies = attr.ib(default=attr.Factory(list))
copyrights_tallies = attr.ib(default=attr.Factory(list))
authors_tallies = attr.ib(default=attr.Factory(list))
holders_summary = attr.ib(default=attr.Factory(list))
copyrights_summary = attr.ib(default=attr.Factory(list))
authors_summary = attr.ib(default=attr.Factory(list))

expected_failures = attr.ib(default=attr.Factory(list))
notes = attr.ib(default=None)
Expand All @@ -83,14 +83,14 @@ def __attrs_post_init__(self, *args, **kwargs):
raise Exception(msg)

# fix counts to be ints: saneyaml loads everything as string
for holders_tally in self.holders_tallies:
holders_tally['count'] = int(holders_tally['count'])
for holders_sum in self.holders_summary:
holders_sum['count'] = int(holders_sum['count'])

for copyrs_tally in self.copyrights_tallies:
copyrs_tally['count'] = int(copyrs_tally['count'])
for copyrs_sum in self.copyrights_summary:
copyrs_sum['count'] = int(copyrs_sum['count'])

for auths_tally in self.authors_tallies:
auths_tally['count'] = int(auths_tally['count'])
for auths_sum in self.authors_summary:
auths_sum['count'] = int(auths_sum['count'])

def to_dict(self):
"""
Expand Down Expand Up @@ -182,25 +182,25 @@ def closure_test_function(*args, **kwargs):
detections = detect_copyrights(test_file)
copyrights, holders, authors = Detection.split_values(detections)

holders_tallies = []
if 'holders_tallies' in test.what:
holders_tallies = as_sorted_mapping(tally_persons(holders))
holders_summary = []
if 'holders_summary' in test.what:
holders_summary = as_sorted_mapping(tally_copyrights(holders))

copyrights_tallies = []
if 'copyrights_tallies' in test.what:
copyrights_tallies = as_sorted_mapping(tally_copyrights(copyrights))
copyrights_summary = []
if 'copyrights_summary' in test.what:
copyrights_summary = as_sorted_mapping(tally_copyrights(copyrights))

authors_tallies = []
if 'authors_tallies' in test.what:
authors_tallies = as_sorted_mapping(tally_persons(authors))
authors_summary = []
if 'authors_summary' in test.what:
authors_summary = as_sorted_mapping(tally_persons(authors))

results = dict(
copyrights=copyrights,
authors=authors,
holders=holders,
holders_tallies=holders_tallies,
copyrights_tallies=copyrights_tallies,
authors_tallies=authors_tallies,
holders_summary=holders_summary,
copyrights_summary=copyrights_summary,
authors_summary=authors_summary,
)

expected_yaml = test.dumps()
Expand Down
4 changes: 2 additions & 2 deletions tests/cluecode/data/authors/author-config.rpath.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
what:
- authors
- authors_tallies
- authors_summary
authors:
- Gordon Matzigkeit <gord@gnu.ai.mit.edu>
authors_tallies:
authors_summary:
- value: Gordon Matzigkeit <gord@gnu.ai.mit.edu>
count: 1
4 changes: 2 additions & 2 deletions tests/cluecode/data/authors/author_addr_c-addr_c.c.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
what:
- authors
- authors_tallies
- authors_summary
authors:
- John Doe
authors_tallies:
authors_summary:
- value: John Doe
count: 1
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
what:
- authors
- authors_tallies
- authors_summary
authors:
- Avinash Kak (kak@purdue.edu)
- Avinash Kak (kak@purdue.edu)
authors_tallies:
authors_summary:
- value: Avinash Kak (kak@purdue.edu)
count: 2
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
what:
- authors
- authors_tallies
- authors_summary
authors:
- Avinash Kak (kak@purdue.edu)
- Avinash Kak (kak@purdue.edu)
authors_tallies:
authors_summary:
- value: Avinash Kak (kak@purdue.edu)
count: 2
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
what:
- authors
- authors_tallies
- authors_summary
authors:
- the University of California, Berkeley and its contributors
authors_tallies:
authors_summary:
- value: the University of California, Berkeley and its contributors
count: 1
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
what:
- authors
- authors_tallies
- authors_summary
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
what:
- authors
- authors_tallies
- authors_summary
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
what:
- authors
- authors_tallies
- authors_summary
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
what:
- authors
- authors_tallies
- authors_summary
authors:
- Gordon Matzigkeit
authors_tallies:
authors_summary:
- value: Gordon Matzigkeit
count: 1
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
what:
- authors
- authors_tallies
- authors_summary
authors:
- Mohit Agarwal
- Mitsubishi and NTT.
authors_tallies:
authors_summary:
- value: Mitsubishi and NTT.
count: 1
- value: Mohit Agarwal
Expand Down
2 changes: 1 addition & 1 deletion tests/cluecode/data/authors/author_expat-expat_h.h.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
what:
- authors
- authors_tallies
- authors_summary
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
what:
- authors
- authors_tallies
- authors_summary
authors:
- Gary O'Neall
authors_tallies:
authors_summary:
- value: Gary O'Neall
count: 1
4 changes: 2 additions & 2 deletions tests/cluecode/data/authors/author_gthomas_c-c.c.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
what:
- authors
- authors_tallies
- authors_summary
authors:
- gthomas, sorin@netappi.com
- gthomas, sorin@netappi.com, andrew.lunn@ascom.ch
authors_tallies:
authors_summary:
- value: gthomas, sorin@netappi.com
count: 1
- value: gthomas, sorin@netappi.com, andrew.lunn@ascom.ch
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
what:
- authors
- authors_tallies
- authors_summary
authors:
- Scott Violet
authors_tallies:
authors_summary:
- value: Scott Violet
count: 1
4 changes: 2 additions & 2 deletions tests/cluecode/data/authors/author_in_java_tag-java.java.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
what:
- authors
- authors_tallies
- authors_summary
authors:
- Apple Banana Car
authors_tallies:
authors_summary:
- value: Apple Banana Car
count: 1
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
what:
- authors
- authors_tallies
- authors_summary
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
what:
- authors
- authors_tallies
- authors_summary
4 changes: 2 additions & 2 deletions tests/cluecode/data/authors/author_iproute2.c.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
what:
- authors
- authors_tallies
- authors_summary
authors:
- Patrick McHardy <kaber@trash.net>
authors_tallies:
authors_summary:
- value: Patrick McHardy <kaber@trash.net>
count: 1
2 changes: 1 addition & 1 deletion tests/cluecode/data/authors/author_nathan-KEYS.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
what:
- authors
- authors_tallies
- authors_summary
notes: |
name +email is not enough to create an author
hence this is not detected correctly
Expand Down
2 changes: 1 addition & 1 deletion tests/cluecode/data/authors/author_no_author-c.c.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
what:
- authors
- authors_tallies
- authors_summary
2 changes: 1 addition & 1 deletion tests/cluecode/data/authors/author_none-wrong.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
what:
- authors
- authors_tallies
- authors_summary
2 changes: 1 addition & 1 deletion tests/cluecode/data/authors/author_none_c-c.c.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
what:
- authors
- authors_tallies
- authors_summary
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
what:
- authors
- authors_tallies
- authors_summary
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
what:
- authors
- authors_tallies
- authors_summary
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
what:
- authors
- authors_tallies
- authors_summary
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
what:
- authors
- authors_tallies
- authors_summary
authors:
- not attributable
authors_tallies:
authors_summary:
- value: not attributable
count: 1
2 changes: 1 addition & 1 deletion tests/cluecode/data/authors/author_russ_c-c.c.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
what:
- authors
- authors_tallies
- authors_summary
notes: these are detected as copyrights, not authors Russ Dill <Russ.Dill@asu.edu> Vladimir
Oleynik <dzo@simtreas.ru>
2 changes: 1 addition & 1 deletion tests/cluecode/data/authors/author_sample-c.c.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
what:
- authors
- authors_tallies
- authors_summary
2 changes: 1 addition & 1 deletion tests/cluecode/data/authors/author_samplepy-py.py.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
what:
- authors
- authors_tallies
- authors_summary
2 changes: 1 addition & 1 deletion tests/cluecode/data/authors/author_snippet.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
what:
- authors
- authors_tallies
- authors_summary
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
what:
- authors
- authors_tallies
- authors_summary
authors:
- faith@dict.org
authors_tallies:
authors_summary:
- value: faith@dict.org
count: 1
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
what:
- authors
- authors_tallies
- authors_summary
authors:
- Philip Milne
- Scott Violet
authors_tallies:
authors_summary:
- value: Philip Milne
count: 1
- value: Scott Violet
Expand Down
4 changes: 2 additions & 2 deletions tests/cluecode/data/authors/author_uc-LICENSE.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
what:
- authors
- authors_tallies
- authors_summary
authors:
- the University of California, Berkeley and its contributors
- UC Berkeley and its contributors
- the University of California, Berkeley and its contributors
authors_tallies:
authors_summary:
- value: the University of California, Berkeley and its contributors
count: 2
- value: UC Berkeley and its contributors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
what:
- authors
- authors_tallies
- authors_summary
authors:
- Erik Schoenfelder (schoenfr@ibr.cs.tu-bs.de)
- Jennifer Bray of Origin (jbray@origin-at.co.uk)
- Simon Leinen (simon@switch.ch)
authors_tallies:
authors_summary:
- value: Erik Schoenfelder (schoenfr@ibr.cs.tu-bs.de)
count: 1
- value: Jennifer Bray of Origin (jbray@origin-at.co.uk)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
what:
- authors
- authors_tallies
- authors_summary
4 changes: 2 additions & 2 deletions tests/cluecode/data/authors/configure.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
what:
- authors
- authors_tallies
- authors_summary
authors:
- Gordon Matzigkeit <gord@gnu.ai.mit.edu>
authors_tallies:
authors_summary:
- value: Gordon Matzigkeit <gord@gnu.ai.mit.edu>
count: 1
2 changes: 1 addition & 1 deletion tests/cluecode/data/authors/cvs_keywords.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
what:
- authors
- authors_tallies
- authors_summary
4 changes: 2 additions & 2 deletions tests/cluecode/data/authors/device_tree.c.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
what:
- authors
- authors_tallies
- authors_summary
authors:
- Jerone Young <jyoung5@us.ibm.com> Hollis Blanchard <hollisb@us.ibm.com>
authors_tallies:
authors_summary:
- value: Jerone Young <jyoung5@us.ibm.com> Hollis Blanchard <hollisb@us.ibm.com>
count: 1
Loading

0 comments on commit e92c8c5

Please sign in to comment.