Пример #1
0
    def test_format_person_various_places_appendix(self):
        """Test various variations of place appendix."""
        expected_cat_meta = []

        # all
        expected_name = 'City, Country'
        self.unset_kuenstler_params(
            ['KueVorNameS', 'KueNameS', 'KudJahrVonL', 'KudJahrBisL',
             'KueFunktionS'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)

        # City only
        expected_name = 'City'
        self.unset_kuenstler_params(['KudLandS'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)

        # Country only
        expected_name = 'Country'
        self.unset_kuenstler_params(['KudOrtS'])
        self.reset_kuenstler_params(['KudLandS'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)

        # Assert none of these added to cat_meta
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #2
0
    def test_format_person_various_places_appendix(self):
        """Test various variations of place appendix."""
        expected_cat_meta = []

        # all
        expected_name = 'City, Country'
        self.unset_kuenstler_params([
            'KueVorNameS', 'KueNameS', 'KudJahrVonL', 'KudJahrBisL',
            'KueFunktionS'
        ])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)

        # City only
        expected_name = 'City'
        self.unset_kuenstler_params(['KudLandS'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)

        # Country only
        expected_name = 'Country'
        self.unset_kuenstler_params(['KudOrtS'])
        self.reset_kuenstler_params(['KudLandS'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)

        # Assert none of these added to cat_meta
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #3
0
 def test_format_person_empty_returns_empty(self):
     expected_name = ''
     expected_cat_meta = []
     self.unset_kuenstler_params()
     self.assertEqual(
         MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
         expected_name)
     self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #4
0
 def test_format_person_empty_returns_empty(self):
     expected_name = ''
     expected_cat_meta = []
     self.unset_kuenstler_params()
     self.assertEqual(
         MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
         expected_name)
     self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #5
0
    def test_format_person_full_info(self):
        expected_name = 'FirstName LastName (Profession, BirthYear-DeathYear) ' \
                        'City, Country'
        expected_cat_meta = []

        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #6
0
    def test_format_person_matching_link(self):
        expected_name = '[[:sv:Some link|FirstName LastName]]'
        expected_cat_meta = []
        self.mock_info.peopleLinkC = {'123': ':sv:Some link'}

        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #7
0
    def test_format_person_full_info(self):
        expected_name = 'FirstName LastName (Profession, BirthYear-DeathYear) ' \
                        'City, Country'
        expected_cat_meta = []

        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #8
0
    def test_format_person_no_place(self):
        expected_name = 'FirstName LastName (Profession, BirthYear-DeathYear)'
        expected_cat_meta = []

        self.unset_kuenstler_params(['KudOrtS', 'KudLandS'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #9
0
    def test_format_person_matching_link(self):
        expected_name = '[[:sv:Some link|FirstName LastName]]'
        expected_cat_meta = []
        self.mock_info.peopleLinkC = {'123': ':sv:Some link'}

        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #10
0
    def test_format_person_no_bracket(self):
        expected_name = 'FirstName LastName, City, Country'
        expected_cat_meta = []

        self.unset_kuenstler_params(
            ['KudJahrVonL', 'KudJahrBisL', 'KueFunktionS'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #11
0
    def test_format_person_matching_creator_not_creative(self):
        expected_name = 'FirstName LastName (Profession, BirthYear-DeathYear) ' \
                        'City, Country'
        expected_cat_meta = []
        self.mock_info.peopleCreatC = {'123': 'Creator:Some template'}

        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #12
0
    def test_format_person_matching_creator_not_creative(self):
        expected_name = 'FirstName LastName (Profession, BirthYear-DeathYear) ' \
                        'City, Country'
        expected_cat_meta = []
        self.mock_info.peopleCreatC = {'123': 'Creator:Some template'}

        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #13
0
    def test_format_person_matching_creator(self):
        expected_name = '{{Creator:Some template}}'
        expected_cat_meta = []
        self.mock_info.peopleCreatC = {'123': 'Creator:Some template'}

        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta,
                                   creative=True),
            expected_name)
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #14
0
    def test_format_person_no_bracket(self):
        expected_name = 'FirstName LastName, City, Country'
        expected_cat_meta = []

        self.unset_kuenstler_params(
            ['KudJahrVonL', 'KudJahrBisL', 'KueFunktionS'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #15
0
    def test_format_person_no_place(self):
        expected_name = 'FirstName LastName (Profession, BirthYear-DeathYear)'
        expected_cat_meta = []

        self.unset_kuenstler_params(
            ['KudOrtS', 'KudLandS'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #16
0
    def test_format_person_trigger_cat_meta(self):
        expected_name = 'FirstName LastName (Profession, BirthYear-DeathYear) ' \
                        'City, Country'
        expected_cat_meta = ['unmatched creator']
        self.mock_info.peopleCreatC = {'123': ''}

        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta,
                                   creative=True),
            expected_name)
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #17
0
    def test_format_person_only_name(self):
        expected_name = 'FirstName LastName'
        expected_cat_meta = []

        self.unset_kuenstler_params([
            'KudJahrVonL', 'KudJahrBisL', 'KueFunktionS', 'KudOrtS', 'KudLandS'
        ])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #18
0
    def test_format_person_matching_creator(self):
        expected_name = '{{Creator:Some template}}'
        expected_cat_meta = []
        self.mock_info.peopleCreatC = {'123': 'Creator:Some template'}

        self.assertEqual(
            MakeInfo.format_person(self.mock_info,
                                   '123',
                                   self.cat_meta,
                                   creative=True), expected_name)
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #19
0
    def test_format_person_only_name(self):
        expected_name = 'FirstName LastName'
        expected_cat_meta = []

        self.unset_kuenstler_params(
            ['KudJahrVonL', 'KudJahrBisL', 'KueFunktionS',
             'KudOrtS', 'KudLandS'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #20
0
    def test_format_person_creator_over_link(self):
        """Test that creator template is prioritised over link."""
        expected_name = '{{Creator:Some template}}'
        expected_cat_meta = []
        self.mock_info.peopleCreatC = {'123': 'Creator:Some template'}
        self.mock_info.peopleLinkC = {'123': ':sv:Some link'}

        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta,
                                   creative=True),
            expected_name)
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #21
0
    def test_format_person_trigger_cat_meta(self):
        expected_name = 'FirstName LastName (Profession, BirthYear-DeathYear) ' \
                        'City, Country'
        expected_cat_meta = ['unmatched creator']
        self.mock_info.peopleCreatC = {'123': ''}

        self.assertEqual(
            MakeInfo.format_person(self.mock_info,
                                   '123',
                                   self.cat_meta,
                                   creative=True), expected_name)
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #22
0
    def test_format_person_creator_over_link(self):
        """Test that creator template is prioritised over link."""
        expected_name = '{{Creator:Some template}}'
        expected_cat_meta = []
        self.mock_info.peopleCreatC = {'123': 'Creator:Some template'}
        self.mock_info.peopleLinkC = {'123': ':sv:Some link'}

        self.assertEqual(
            MakeInfo.format_person(self.mock_info,
                                   '123',
                                   self.cat_meta,
                                   creative=True), expected_name)
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #23
0
    def test_format_person_various_brackets(self):
        """Test various variations of bracket contents."""
        expected_cat_meta = []

        # all
        expected_name = '(Profession, BirthYear-DeathYear)'
        self.unset_kuenstler_params(
            ['KueVorNameS', 'KueNameS', 'KudOrtS', 'KudLandS'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)

        # Profession only
        expected_name = '(Profession)'
        self.unset_kuenstler_params(['KudJahrVonL', 'KudJahrBisL'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)

        # Year only
        expected_name = '(BirthYear-DeathYear)'
        self.unset_kuenstler_params(['KueFunktionS'])
        self.reset_kuenstler_params(['KudJahrVonL', 'KudJahrBisL'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)

        # Birth year range only
        expected_name = '(BirthYear-)'
        self.unset_kuenstler_params(['KudJahrBisL'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)

        # Death year range only
        expected_name = '(-DeathYear)'
        self.unset_kuenstler_params(['KudJahrVonL'])
        self.reset_kuenstler_params(['KudJahrBisL'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)

        # Year range and profession only
        expected_name = '(Profession, -DeathYear)'
        self.reset_kuenstler_params(['KueFunktionS'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)

        # Assert none of these added to cat_meta
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)
Пример #24
0
    def test_format_person_various_brackets(self):
        """Test various variations of bracket contents."""
        expected_cat_meta = []

        # all
        expected_name = '(Profession, BirthYear-DeathYear)'
        self.unset_kuenstler_params(
            ['KueVorNameS', 'KueNameS', 'KudOrtS', 'KudLandS'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)

        # Profession only
        expected_name = '(Profession)'
        self.unset_kuenstler_params(['KudJahrVonL', 'KudJahrBisL'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)

        # Year only
        expected_name = '(BirthYear-DeathYear)'
        self.unset_kuenstler_params(['KueFunktionS'])
        self.reset_kuenstler_params(['KudJahrVonL', 'KudJahrBisL'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)

        # Birth year range only
        expected_name = '(BirthYear-)'
        self.unset_kuenstler_params(['KudJahrBisL'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)

        # Death year range only
        expected_name = '(-DeathYear)'
        self.unset_kuenstler_params(['KudJahrVonL'])
        self.reset_kuenstler_params(['KudJahrBisL'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)

        # Year range and profession only
        expected_name = '(Profession, -DeathYear)'
        self.reset_kuenstler_params(['KueFunktionS'])
        self.assertEqual(
            MakeInfo.format_person(self.mock_info, '123', self.cat_meta),
            expected_name)

        # Assert none of these added to cat_meta
        self.assertItemsEqual(self.cat_meta, expected_cat_meta)