def test_copyright_lines_andre_darcy(self): test_file = self.get_test_loc('copyrights_basic/andre_darcy-c.c') expected = [ copyrights.CopyrightDetection('Copyright (c) 1995, Pascal Andre ([email protected])', 5, 6), copyrights.CopyrightDetection(u"copyright 1997, 1998, 1999 by D'Arcy J.M. Cain ([email protected])", 25, 26) ] check_full_detections(expected, test_file)
def test_copyright_lines_addr_c(self): test_file = self.get_test_loc('copyrights_basic/addr_c-addr_c.c') expected = [ copyrights.CopyrightDetection('Copyright 1999 Cornell University', 4, 4), copyrights.CopyrightDetection('Copyright 2000 Jon Doe', 5, 5) ] check_full_detections(expected, test_file)
def test_copyright_lines_boost_vector(self): test_file = self.get_test_loc('copyrights_basic/vector50.hpp') expected = [ copyrights.CopyrightDetection('Copyright (c) 2005 Arkadiy Vertleyb', 2, 2), copyrights.CopyrightDetection('Copyright (c) 2005 Peder Holt', 3, 3), ] check_full_detections(expected, test_file)
def test_copyright_lines_android_c(self): test_file = self.get_test_loc('copyrights_basic/android_c-c.c') expected = [ copyrights.CopyrightDetection('Copyright (c) 2009 The Android Open Source Project', 2, 2), copyrights.CopyrightDetection('Copyright 2003-2005 Colin Percival', 23, 23) ] check_full_detections(expected, test_file)
def test_copyright_lines_atheros_spanning_lines(self): test_file = self.get_test_loc('copyrights_basic/atheros_spanning_lines-py.py') expected = [ copyrights.CopyrightDetection('Copyright (c) 2000 Atheros Communications, Inc.', 2, 2), copyrights.CopyrightDetection('Copyright (c) 2001 Atheros Communications, Inc.', 3, 3), copyrights.CopyrightDetection('Copyright (c) 1994-1997 by Intel Corporation', 10, 11) ] check_full_detections(expected, test_file)
def test_copyright_lines_03e16f6c_0(self): test_file = self.get_test_loc('copyrights_basic/03e16f6c_0-e_f_c.0') expected = [ copyrights.CopyrightDetection('Copyright (c) 1997 Microsoft Corp.', 31, 31), copyrights.CopyrightDetection('Copyright (c) 1997 Microsoft Corp.', 35, 35), copyrights.CopyrightDetection('Copyright (c) 1997 Microsoft', 61, 61) ] check_full_detections(expected, test_file)
def test_copyright_lines_abiword_common_copyright(self): test_file = self.get_test_loc('copyrights_basic/abiword_common.copyright') expected = [ copyrights.CopyrightDetection('Copyright (c) 1998- AbiSource, Inc. & Co.', 15, 17), copyrights.CopyrightDetection('Copyright (c) 2009 Masayuki Hatta', 41, 41), copyrights.CopyrightDetection('Copyright (c) 2009 Patrik Fimml <*****@*****.**>', 42, 42), ] check_full_detections(expected, test_file)
def test_copyright_lines_apache_notice(self): test_file = self.get_test_loc('copyrights_basic/apache_notice-NOTICE') expected = [ copyrights.CopyrightDetection('Copyright 1999-2006 The Apache Software Foundation', 7, 7), copyrights.CopyrightDetection('Copyright 1999-2006 The Apache Software Foundation', 17, 17), copyrights.CopyrightDetection('Copyright 2001-2003,2006 The Apache Software Foundation', 28, 28), copyrights.CopyrightDetection('copyright (c) 2000 World Wide Web Consortium, http://www.w3.org', 34, 34) ] check_full_detections(expected, test_file)
def test_copyright_lines_3a3b02ce_0(self): # this is a certificate and the actual copyright holder is not clear: # could be either Wisekey or OISTE Foundation. test_file = self.get_test_loc('copyrights_basic/3a3b02ce_0-a_b_ce.0') expected = [ copyrights.CopyrightDetection('Copyright (c) 2005, OU OISTE Foundation', 31, 31), copyrights.CopyrightDetection('Copyright (c) 2005, OU OISTE Foundation', 35, 35), ] check_full_detections(expected, test_file)
def test_copyright_lines_babkin_txt(self): test_file = self.get_test_loc('copyrights_basic/babkin_txt.txt') expected = [ copyrights.CopyrightDetection('Copyright (c) North', 1, 1), copyrights.CopyrightDetection('Copyright (c) South', 2, 2), copyrights.CopyrightDetection('Copyright (c) 2001 by the TTF2PT1 project', 4, 4), copyrights.CopyrightDetection('Copyright (c) 2001 by Sergey Babkin', 5, 5), ] check_full_detections(expected, test_file)
def test_copyright_lines_blender_debian(self): test_file = self.get_test_loc('copyrights_basic/blender_debian-blender.copyright') expected = [ copyrights.CopyrightDetection('Copyright (c) 2002-2008 Blender Foundation', 9, 9), copyrights.CopyrightDetection('Copyright (c) 2004-2005 Masayuki Hatta <*****@*****.**>', 31, 31), copyrights.CopyrightDetection('(c) 2005-2007 Florian Ernst <*****@*****.**>', 32, 32), copyrights.CopyrightDetection('(c) 2007-2008 Cyril Brulebois <*****@*****.**>', 33, 33), ] check_full_detections(expected, test_file)
def test_detect_with_lines(self): location = self.get_test_loc('copyrights_basic/essential_smoke-ibm_c.c') expected = [ copyrights.CopyrightDetection('Copyright IBM and others (c) 2008', 6, 6), copyrights.HolderDetection('IBM and others', 6, 6), copyrights.CopyrightDetection('Copyright Eclipse, IBM and others', 8, 8), copyrights.HolderDetection('Eclipse, IBM and others', 8, 8), copyrights.CopyrightDetection('(c) 2008', 8, 8) ] results = list(copyrights.detect_copyrights(location)) assert results == expected
def test_detect(self): location = self.get_test_loc('copyrights_basic/essential_smoke-ibm_c.c') expected = [ copyrights.CopyrightDetection('Copyright IBM and others (c) 2008', 6, 6), copyrights.CopyrightDetection('Copyright Eclipse, IBM and others', 8, 8), copyrights.CopyrightDetection('(c) 2008', 8, 8), ] results = list(copyrights.detect_copyrights( location, include_holders=False, include_authors=False, )) assert results == expected
def test_copyright_lines_acme_c(self): test_file = self.get_test_loc('copyrights_basic/acme_c-c.c') expected = [ copyrights.CopyrightDetection('Copyright (c) 2000 ACME, Inc.', 1, 1) ] check_full_detections(expected, test_file)
def test_copyright_lines_audio_c(self): test_file = self.get_test_loc('copyrights_basic/audio_c-c.c') expected = [ copyrights.CopyrightDetection('copyright (c) 1995, AudioCodes, DSP Group, France Telecom, Universite de Sherbrooke', 3, 4) ] check_full_detections(expected, test_file)
def test_company_lines_name_in_java(self): test_file = self.get_test_loc('copyrights_basic/company_name_in_java-9_java.java') expected = [ copyrights.CopyrightDetection('Copyright (c) 2008-2011 Company Name Incorporated', 2, 2) ] check_full_detections(expected, test_file)
def test_copyright_lines_ABC_file_cpp(self): test_file = self.get_test_loc('copyrights_basic/ABC_file_cpp-File_cpp.cpp') expected = [ copyrights.CopyrightDetection('Copyright (c) ABC Company', 12, 12) ] check_full_detections(expected, test_file)
def test_copyright_lines_att_in_c(self): test_file = self.get_test_loc('copyrights_basic/att_in_c-9_c.c') expected = [ copyrights.CopyrightDetection('Copyright (c) 1991 by AT&T.', 5, 5), ] check_full_detections(expected, test_file)
def test_copyright_lines_heunrich_c(self): test_file = self.get_test_loc('copyrights_basic/heunrich_c-c.c') expected = [ copyrights.CopyrightDetection('Copyright (c) 2000 HEUNRICH HERTZ INSTITUTE', 5, 5) ] check_full_detections(expected, test_file)
def test_copyright_lines_aptitude_copyright_label(self): test_file = self.get_test_loc('copyrights_basic/aptitude-aptitude.label') expected = [ copyrights.CopyrightDetection('Copyright 1999-2005 Daniel Burrows <*****@*****.**>', 1, 1) ] check_full_detections(expected, test_file)
def test_copyright_lines_sample_py(self): test_file = self.get_test_loc('copyrights_basic/sample_py-py.py') expected = [ copyrights.CopyrightDetection('COPYRIGHT 2006 ABC', 6, 6) ] check_full_detections(expected, test_file)
def test_copyright_lines_isc(self): test_file = self.get_test_loc('copyrights_basic/isc-c.c') expected = [ copyrights.CopyrightDetection('Copyright (c) 1998-2000 The Internet Software Consortium', 3, 3) ] check_full_detections(expected, test_file)
def test_copyright_lines_aleal(self): test_file = self.get_test_loc('copyrights_basic/aleal-c.c') expected = [ copyrights.CopyrightDetection('copyright (c) 2006 by aleal', 2, 2) ] check_full_detections(expected, test_file)
def test_copyright_lines_adler_inflate_c(self): test_file = self.get_test_loc('copyrights_basic/adler_inflate_c-inflate_c.c') expected = [ copyrights.CopyrightDetection('Not copyrighted 1992 by Mark Adler', 1, 1) ] check_full_detections(expected, test_file)
def test_copyright_lines_abc(self): test_file = self.get_test_loc('copyrights_basic/abc') expected = [ copyrights.CopyrightDetection('Copyright (c) 2006 abc.org', 2, 2) ] check_full_detections(expected, test_file)
def test_copyright_lines_activefieldattribute_cs(self): test_file = self.get_test_loc('copyrights_basic/activefieldattribute_cs-ActiveFieldAttribute_cs.cs') expected = [ copyrights.CopyrightDetection('Copyright 2009 - Thomas Hansen [email protected]', 3, 4) ] check_full_detections(expected, test_file)
def test_copyright_lines_abc_loss_of_holder_c(self): test_file = self.get_test_loc('copyrights_basic/abc_loss_of_holder_c-c.c') expected = [ copyrights.CopyrightDetection('copyright abc 2001', 1, 1) ] check_full_detections(expected, test_file)