Beispiel #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])
Beispiel #2
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])
Beispiel #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])
Beispiel #4
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>"
     ])
Beispiel #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>"
     ])
Beispiel #6
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>"
     ])
Beispiel #7
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>"
     ])
Beispiel #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>"
     ])
Beispiel #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>"
     ])