示例#1
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}")
 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)
    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)
示例#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)
示例#5
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)