def test_US_02(self):
     """ FUnction that tests user story 2 """
     repository = Repository("../GEDCOM_Files/US_02.ged")
     expected = ['US_02: Bholu /Desai/ birthday after marriage date on line number 439',
                 'US_02: Naina /Shah/ birthday after marriage date on line number 528',
                 'US_02: Mayur /Desai/ birthday after marriage date on line number 528',
                 'US_02: Keval /Kuchadiya/ birthday after marriage date on line number 545']
     actual = US_2(repository.get_individual(), repository.get_family())
     self.assertEqual(expected, actual)
Exemplo n.º 2
0
        def test_US_03(self):
            """ Function that tests user story 3 """

            repository = Repository("../GEDCOM_Files/US_03.ged")
            expected = [
                'US_03: Suresh /Kapoor/ birthday after death date on line number 52',
                'US_03: Kangana /Patel/ birthday after death date on line number 63'
            ]
            actual = US_3(repository.get_individual())
            self.assertEqual(actual, expected)
    def test_US_06(self):
        """ Contains test cases for US_06"""
        repository = Repository("../GEDCOM_Files/US_06.ged")

        actual = [
            'US_06: Saumya /Shah/ Death 1822-01-03 occured prior to the divorce date 1852-07-14'
        ]

        output = US_06(repository.get_individual(), repository.get_family())

        self.assertEqual(output, actual)
Exemplo n.º 4
0
        def test_US_08(self):
            """ The function is to test US_08 function"""
            repository = Repository('../GEDCOM_Files/US_02.ged')

            expected = [
                "Family id Line number: 523\n The Father @I31@ is younger than his child @I33@ which is illegal."
            ]

            actual = US_08(repository.get_individual(),
                           repository.get_family())

            self.assertEqual(actual, expected)
def US_3(individual):

    repository = Repository("../GEDCOM_Files/US_03.ged")
    individual = repository.get_individual()
    """ checks if a person's birthday occurs before their death day """
    warnings = list()

    for person in individual.values():
        if person._birth_date != 'NA' and person._death_date != 'NA':
            if person._birth_date > person._death_date:
                warnings.append(
                    f'US_03: {person._name} birthday after death date on line number {person.get_line_numbers()["date"]["death"]}'
                )

    return warnings
Exemplo n.º 6
0
    def test_US_12(self):
        """ Contains test cases for US_12"""
        indi_repo: Repository = Repository("../GEDCOM_Files/US_12.ged")

        exp = ["US_12: Yatinkumar /Shiyani/ with @I27@ is 80 years or older than Mia /Shiyani/ id:{'@I28@'} in line number 398 ", "US_12: Priyanka /Robinson/ with @I2@ is 60 years or older than Mia /Shiyani/ id:{'@I28@'} in line number 398 "]

        actual = US_12(indi_repo._individual, indi_repo._family)

        self.assertEqual(actual, exp)
Exemplo n.º 7
0
        def test_us09(self):
            """ The function is to test US_09 function"""
            repository = Repository('../GEDCOM_Files/US_02.ged')

            # The expected output
            expected = [
                'Family id Line number: 426\n Birth of child @I28@ is before the death of the father @I27@',
                'Family id Line number: 426\n Birth of child @I28@ is before the death of the mother @I2@',
                'Family id Line number: 451\n Birth of child @I38@ is before the death of the father @I3@',
                'Family id Line number: 451\n Birth of child @I38@ is before the death of the mother @I4@',
                'Family id Line number: 451\n Birth of child @I31@ is before the death of the father @I3@',
                'Family id Line number: 451\n Birth of child @I31@ is before the death of the mother @I4@',
                'Family id Line number: 451\n Birth of child @I35@ is before the death of the father @I3@',
                'Family id Line number: 451\n Birth of child @I35@ is before the death of the mother @I4@'
            ]

            actual = US_09(repository.get_individual(),
                           repository.get_family())

            self.assertEqual(actual, expected)
Exemplo n.º 8
0
    def test_US_13(self):
        """ The function helps to test US_13 function"""
        indi_repo: Repository = Repository("../GEDCOM_Files/US_02.ged")
        expected = {
            'The family id @F13@ has twins Emmy /Robinson/ and Bholu /Desai/ and Line number: 508',
            'The family id @F13@ has twins Jil /Robinson/ and Bholu /Desai/ and Line number: 508',
            'The family id @F13@ has twins Emmy /Robinson/ and Jil /Robinson/ and Line number: 508'
        }

        actual = US_13(indi_repo._family, indi_repo._individual)

        print(actual)

        self.assertEqual(actual, expected)
Exemplo n.º 9
0
        def test_US_33(self):
            """ Tests US33. checks that list all orphans. """

            repository = Repository("../GEDCOM_Files/US_33.ged")
            output = ['@I1@ Amrita /Khan/ has age 14 and is orphan']
            self.assertEqual(US_33(repository), output)
            self.assertTrue(
                US_33(repository) ==
                ['@I1@ Amrita /Khan/ has age 14 and is orphan'])
            self.assertFalse(
                US_33(repository) ==
                ['@I1@ Saif /Khan/ 13 is orphan and age is less than 18'])
            self.assertTrue(
                US_33(repository) !=
                ['@I1@ Kareena /Kapoor/ 16 is orphan and age is less than 18'])
Exemplo n.º 10
0
    def test_user_story_11(self):
        """ Tests that husbands and wifes are not married twice at the same time and prints out the cases if so"""

        repository = Repository('../GEDCOM_Files/US_11.ged')
        output = [
            'Ramesh /Patel/married twice at the same time',
            'Anushka /Shah/married twice at the same time'
        ]
        self.assertEqual(US_11(repository), output)
        self.assertNotEqual(US_11(repository),
                            ['Suresh /Kapoor married twice on the same time'])
        self.assertTrue(
            US_11(repository) == [
                'Ramesh /Patel/married twice at the same time',
                'Anushka /Shah/married twice at the same time'
            ])
        self.assertFalse(
            US_11(repository) ==
            ['Kangana /Patel married twice on the same time'])
        self.assertTrue(
            US_11(repository) !=
            ['Suresh /Patel married twice on the same time'])
Exemplo n.º 11
0
def main():
    """ Function that runs all the user stories and prints their results. """
    sys.stdout = Logger()
    # Creating an object of class Repository that will contains both individual and family dictionaries.
    # Pass the path of your GEDCOM file as a parameter below.
    repository = Repository("../GEDCOM_Files/US_02.ged")
    repository1 = Repository("../GEDCOM_Files/US_03.ged")
    repository2 = Repository("../GEDCOM_Files/US_33.ged")
    repository3 = Repository("../GEDCOM_Files/US_06.ged")
    repository4 = Repository("../GEDCOM_Files/US_12.ged")
    individual = repository.get_individual()
    individual1 = repository1.get_individual()
    individual2 = repository2.get_individual()
    individual3 = repository3.get_individual()
    individual4 = repository4.get_individual()
    family = repository.get_family()
    family3 = repository3.get_family()
    family4 = repository4.get_family()

    # Prints individual pretty table.
    repository.individual_pretty_table()
    # Prints family pretty table.
    repository.family_pretty_table()

    for item in US_2(individual, family):
        print(item)

    for item in US_3(individual1):
        print(item)

    for item in US_05(individual, family):
        print(f"US-05: {item}")

    for item in US_06(individual3, family3):
        print(f"{item}")

    for item in US_08(individual, family):
        print(f"US-08: {item}")

    for item in US_09(individual, family):
        print(f"US-09: {item}")

    for item in US_11(repository):
        print(f"US_11: {item}")

    for item in US_12(individual4, family4):
        print(f"US_12: {item}")

    for item in US_13(family, individual):
        print(f"US_13: {item}")

    for item in US_33(repository2):
        print(f"US_33: {item}")