示例#1
0
    def test_extra_year(self):
        with self.assertRaises(ValueError) as context:
            sort_copyrights([
                "Copyright © 2015, 2016, 2018 John Doe <foo@bar>",
                "Copyright © 2016 John Doe <foo@bar>",
                "Copyright © 2016, 2017, 2019 John Doe <foo@bar>"
            ])

        self.assertIn('First copyright found for <foo@bar> is missing years {2017, 2019}', context.exception.args[0])
示例#2
0
文件: test.py 项目: Squareys/corrade
    def test_extra_year(self):
        with self.assertRaises(ValueError) as context:
            sort_copyrights([
                "Copyright © 2015, 2016, 2018 John Doe <foo@bar>",
                "Copyright © 2016 John Doe <foo@bar>",
                "Copyright © 2016, 2017, 2019 John Doe <foo@bar>"
            ])

        self.assertIn('First copyright found for <foo@bar> is missing years {2017, 2019}', context.exception.args[0])
示例#3
0
    def test_extra_year2(self):
        with self.assertRaises(ValueError) as context:
            sort_copyrights([
                "Copyright © 2016 John Doe <foo@bar>",
                # After this entry the set needs to get updated, otherwise
                # 2018 will get lost
                "Copyright © 2016, 2018 John Doe <foo@bar>",
                "Copyright © 2016, 2020 John Doe <foo@bar>"
            ])

        self.assertIn(
            'First copyright found for <foo@bar> is missing years {2020}',
            context.exception.args[0])
示例#4
0
文件: test.py 项目: Squareys/corrade
 def test_pick_longer(self):
     self.assertEqual(sort_copyrights([
         "Copyright © 2015 John Doe <foo@bar>",
         "Copyright © 2015, 2016, 2018 John Doe <foo@bar>"
     ]), [
         "Copyright © 2015, 2016, 2018 John Doe <foo@bar>"
     ])
示例#5
0
 def test_pick_longer(self):
     self.assertEqual(sort_copyrights([
         "Copyright © 2015 John Doe <foo@bar>",
         "Copyright © 2015, 2016, 2018 John Doe <foo@bar>"
     ]), [
         "Copyright © 2015, 2016, 2018 John Doe <foo@bar>"
     ])
示例#6
0
文件: test.py 项目: Squareys/corrade
 def test_pick_earlier(self):
     self.assertEqual(sort_copyrights([
         "Copyright © 2015, 2016, 2018 John Doe <foo@bar>",
         "Copyright © 2018 John Doe <foo@bar>",
         "Copyright © 1997, 2003 Boo Bee <bar@bar>",
         "Copyright © 2016 John Doe <foo@bar>"
     ]), [
         "Copyright © 1997, 2003 Boo Bee <bar@bar>",
         "Copyright © 2015, 2016, 2018 John Doe <foo@bar>"
     ])
示例#7
0
文件: test.py 项目: Squareys/corrade
 def test_sort(self):
     self.assertEqual(sort_copyrights([
         "Copyright © 2015, 2016 John Doe <foo@bar>",
         "Copyright © 1997, 2003 Boo Bee <bar@bar>",
         "Copyright © 2018 Ho <hu@he>"
     ]), [
         "Copyright © 1997, 2003 Boo Bee <bar@bar>",
         "Copyright © 2015, 2016 John Doe <foo@bar>",
         "Copyright © 2018 Ho <hu@he>"
     ])
示例#8
0
 def test_pick_earlier(self):
     self.assertEqual(sort_copyrights([
         "Copyright © 2015, 2016, 2018 John Doe <foo@bar>",
         "Copyright © 2018 John Doe <foo@bar>",
         "Copyright © 1997, 2003 Boo Bee <bar@bar>",
         "Copyright © 2016 John Doe <foo@bar>"
     ]), [
         "Copyright © 1997, 2003 Boo Bee <bar@bar>",
         "Copyright © 2015, 2016, 2018 John Doe <foo@bar>"
     ])
示例#9
0
 def test_sort(self):
     self.assertEqual(sort_copyrights([
         "Copyright © 2015, 2016 John Doe <foo@bar>",
         "Copyright © 1997, 2003 Boo Bee <bar@bar>",
         "Copyright © 2018 Ho <hu@he>"
     ]), [
         "Copyright © 1997, 2003 Boo Bee <bar@bar>",
         "Copyright © 2015, 2016 John Doe <foo@bar>",
         "Copyright © 2018 Ho <hu@he>"
     ])