Пример #1
0
    def test_candidate_lines_complex(self):
        lines = '''
           Apache Xalan (Xalan XSLT processor)
           Copyright 1999-2006 The Apache Software Foundation

           Apache Xalan (Xalan serializer)

           This product includes software developed at
           The Apache Software Foundation (http://www.apache.org/).


           =========================================================================
           Portions of this software was originally based on the following:
             - software copyright (c) 1999-2002, Lotus Development Corporation.,
               http://www.lotus.com.
             - software copyright (c) 2001-2002, Sun Microsystems.,
               http://www.sun.com.
             - software copyright (c) 2003, IBM Corporation.,
               http://www.ibm.com.

           =========================================================================
           The binary distribution package (ie. jars, samples and documentation) of
           this product includes software developed by the following:
        '''.splitlines(False)

        expected = [
            [(3,
              '           Copyright 1999-2006 The Apache Software Foundation')
             ],
            [(7, '           This product includes software developed at'),
             (8,
              '           The Apache Software Foundation (http://www.apache.org/).'
              )],
            [(13,
              '             - software copyright (c) 1999-2002, Lotus Development Corporation.,'
              ), (14, '               http://www.lotus.com.'),
             (15,
              '             - software copyright (c) 2001-2002, Sun Microsystems.,'
              ), (16, '               http://www.sun.com.'),
             (17,
              '             - software copyright (c) 2003, IBM Corporation.,'),
             (18, '               http://www.ibm.com.')],
            [(22,
              '           this product includes software developed by the following:'
              )]
        ]

        result = list(copyrights_module.candidate_lines(enumerate(lines, 1)))
        assert expected == result
 def test_candidate_lines_simple(self):
     lines = [(1, ' test (C) all rights reserved')]
     result = list(copyrights.candidate_lines(lines))
     expected = [[(1, ' test (C) all rights reserved')]]
     assert result == expected