示例#1
0
    def test_begin_end_from_header(self):
        """Test begin_end_from_header method"""

        THIS_YEAR = 2345

        def this_year():
            return THIS_YEAR

        vsc.install.headers._this_year = this_year

        self.assertEqual(
            list(
                begin_end_from_header(
                    "#\n# Copyright 1234-5678 something\n#\n")),
            [1234, THIS_YEAR],
            msg='extracted beginyear from copyright, set thisyear as endyear')

        self.assertEqual(
            list(begin_end_from_header("#\n# Copyright 1234 something\n#\n")),
            [1234, THIS_YEAR],
            msg=
            'extracted beginyear from copyright no endyear, set thisyear as endyear'
        )

        self.assertEqual(
            list(begin_end_from_header("#\n# no Copyright something\n#\n")),
            [THIS_YEAR, THIS_YEAR],
            msg='no beginyear found, set thisyear as begin and endyear')
示例#2
0
    def test_begin_end_from_header(self):
        """Test begin_end_from_header method"""

        THIS_YEAR = 2345
        def this_year():
            return THIS_YEAR

        vsc.install.headers._this_year = this_year

        self.assertEqual(list(begin_end_from_header("#\n# Copyright 1234-5678 something\n#\n")),
                         [1234, THIS_YEAR], msg='extracted beginyear from copyright, set thisyear as endyear')

        self.assertEqual(list(begin_end_from_header("#\n# Copyright 1234 something\n#\n")),
                         [1234, THIS_YEAR], msg='extracted beginyear from copyright no endyear, set thisyear as endyear')

        self.assertEqual(list(begin_end_from_header("#\n# no Copyright something\n#\n")),
                         [THIS_YEAR, THIS_YEAR], msg='no beginyear found, set thisyear as begin and endyear')