def test_is_candidate_should_not_select_lines_made_only_of_punct_and_digits(self): lines = ''' 25 17 1 -80.00000 .25000 37.00000 .25000 0: 5107 -2502 -700 496 -656 468 -587 418 -481 347 -325 256 -111 152 166 50 493 -37 854 -96 1221 -118 1568 -125 1953 -143 2433 -195 2464 -281 2529 -395 1987 -729 447 -916 -3011 -1181 -5559 -406 -6094 541 -5714 1110 -5247 1289 -4993 1254 -4960 1151 1: 4757 -1695 -644 429 -627 411 -602 368 -555 299 -470 206 -328 96 -125 -15 126 -105 391 -146 634 -120 762 -58 911 -13 1583 -8 1049 -28 1451 123 1377 -464 907 -603 -4056 -1955 -6769 -485 -5797 929 -4254 1413 -3251 1295 -2871 993 -2899 724 2: 4413 -932 -563 355 -566 354 -582 322 -597 258 -579 164 -499 45 -341 -84 -127 -192 93 -234 288 -157 190 -25 -145 65 1065 74 -1087 -40 -877 1058 -994 18 1208 694 -5540 -3840 -7658 -332 -4130 1732 -1668 1786 -634 1127 -525 501 -856 110 '''.splitlines() for line in lines: line, _ = copyrights.prep_line(line) assert not copyrights.is_candidate(line)
def test_is_end_of_statement(self): line = ''' "All rights reserved\\n"''' _line, char_only_line = copyrights.prep_line(line) assert copyrights.is_end_of_statement(char_only_line)
def test_is_candidate_should_select_line_with_iso_date_year(self): line = 'sig 3 ccd6f801 2006-11-15 nathan mittler <*****@*****.**>' line, _char_only = copyrights.prep_line(line) assert copyrights.is_candidate(line)
def test_is_candidate_should_select_line_with_proper_years2(self): line = '01061C3F5280CD4,2016 152B81E452BD820154' line, _char_only = copyrights.prep_line(line) assert copyrights.is_candidate(line)
def test_is_candidate_should_select_line_with_dashed_year(self): line = 'pub 1024D/CCD6F801 2006-11-15' line, _char_only = copyrights.prep_line(line) assert copyrights.is_candidate(line)
def test_is_candidate_should_not_select_line_with_junk_hex(self): line = '01061C3F5280CD4AC504152B81E452BD82015442014' line, _char_only = copyrights.prep_line(line) assert not copyrights.is_candidate(line)
def test_is_candidate_should_select_line_with_a_trailing_years(self): line = '01061C3F5280CD4AC504152B81E452BD820154 2014\n' line, _char_only = copyrights.prep_line(line) assert copyrights.is_candidate(line)
def test_is_candidate_should_select_line_with_sign(self): line = 'template<class V> struct v_iter<V, mpl::int_<10> (c) { typedef typename V::item10 type; typedef v_iter<V, mpl::int_<10 + 1> > next; };' line, _char_only = copyrights.prep_line(line) assert copyrights.is_candidate(line)
def test_is_candidate_should_not_select_line_with_only_two_digit_numbers(self): line = 'template<class V> struct v_iter<V, mpl::int_<10> > { typedef typename V::item10 type; typedef v_iter<V, mpl::int_<10 + 1> > next; };' line, _char_only = copyrights.prep_line(line) assert not copyrights.is_candidate(line)
def test_is_candidates_should_not_select_line_with_full_year_before_160_and_after_2018(self): line = '1959 2019' line, _char_only = copyrights.prep_line(line) assert not copyrights.is_candidate(line)
def test_is_candidates_should_not_select_line_with_bare_full_year(self): line = '2012' line, _char_only = copyrights.prep_line(line) assert not copyrights.is_candidate(line)
def test_is_candidate_should_select_line_with_proper_years(self): line = '01061C3F5280CD4AC504152B81E452BD820154 2014-' line, _char_only = copyrights_module.prep_line(line) assert copyrights_module.is_candidate(line)