Exemple #1
0
               sex='F',
               birthday=datetime(day=2, month=3, year=1962)),
    Individual('5',
               name='Ava /White/',
               sex='F',
               birthday=datetime(day=1, month=4, year=1985),
               child='F2'),
    Individual('6',
               name='Maria /White/',
               sex='F',
               birthday=datetime(day=9, month=10, year=1988),
               child='F2'),
    Individual('7',
               name='Ken /White/',
               sex='M',
               birthday=datetime(day=30, month=1, year=1946)),
    Individual('8',
               name='Ana /White/',
               sex='F',
               birthday=datetime(day=3, month=5, year=1940))
]

_families = [
    Family('F1', husband_id='3', wife_id='4', children=['1', '2', '9', '10']),
    Family('F2', husband_id='7', wife_id='8', children=['5', '6'])
]

three_sons_one_diff = Tree()

[three_sons_one_diff.add_individual(i) for i in _individuals]
[three_sons_one_diff.add_family(f) for f in _families]
Exemple #2
0
               name='Toosy /Goose/',
               sex='F',
               birthday=datetime(day=25, month=4, year=1950)),
    Individual('5',
               name='Becky /Tech/',
               sex='M',
               birthday=datetime(day=25, month=5, year=1951)),
    Individual('6',
               name='Lecky /Tech/',
               sex='F',
               birthday=datetime(day=10, month=6, year=1950)),
]

_families = [
    Family('F1',
           husband_id='1',
           wife_id='2',
           married=datetime(day=1, month=1, year=1948)),
    Family('F2',
           husband_id='3',
           wife_id='4',
           married=datetime(day=1, month=1, year=1963)),
    Family('F3',
           husband_id='5',
           wife_id='6',
           married=datetime(day=1, month=1, year=1951)),
]

born_wed = Tree()

[born_wed.add_individual(i) for i in _individuals]
[born_wed.add_family(f) for f in _families]
from datetime import datetime

from lib.GedObjects import Tree
from lib.GedObjects import Family
from lib.GedObjects import Individual

_individuals = [
    Individual('1', name='Evan /Doe/', sex='M', birthday=datetime(day=12, month=4, year=1998)),
    Individual('2', name='Elena /Doe/', sex='F', birthday=datetime(day=15, month=9, year=2000)),
    Individual('3', name='John /Doe/', sex='M', birthday=datetime(day=2, month=3, year=1962)),
    Individual('4', name='Jane /Doe/', sex='F', birthday=datetime(day=2, month=3, year=1962)),
    Individual('5', name='Ava /White/', sex='M', birthday=datetime(day=1, month=4, year=1985)),
    Individual('6', name='Maria /White/', sex='F', birthday=datetime(day=9, month=10, year=1988)),
    Individual('7', name='Ken /White/', sex='M', birthday=datetime(day=30, month=1, year=1946)),
    Individual('8', name='Ana /White/', sex='F', birthday=datetime(day=3, month=5, year=1940)) 
]

_families = [
    Family('F1', husband_id='3', wife_id='4', children=['1', '2'])
]

all_correct_gender = Tree()

[all_correct_gender .add_individual(i) for i in _individuals]
[all_correct_gender .add_family(f) for f in _families]
               sex='F',
               birthday=datetime(day=25, month=4, year=1999)),
    Individual('5',
               name='Lorry /Tot/',
               sex='M',
               birthday=datetime(day=25, month=5, year=1951)),
    Individual('6',
               name='Borry /Tot/',
               sex='F',
               birthday=datetime(day=10, month=6, year=1950)),
]

_families = [
    Family('F1',
           husband_id='1',
           wife_id='2',
           children='3',
           married=datetime(day=1, month=1, year=1948)),
    Family('F2',
           husband_id='5',
           wife_id='6',
           children='4',
           married=datetime(day=1, month=1, year=1963)),
]

parents_age_okay = Tree()

[parents_age_okay.add_individual(i) for i in _individuals]
[parents_age_okay.add_family(f) for f in _families]

_individuals2 = [
import unittest
from datetime import datetime
from lib.test.trees import us30_us34_tree
from lib.GedObjects import Tree, Family, Individual

_families = [
    Family('F1',
           husband_id='2',
           wife_id='1',
           married=datetime(day=1, month=12, year=1980)),
    Family('F2',
           husband_id='3',
           wife_id='4',
           married=datetime(day=15, month=9, year=1993)),
    Family('F3',
           husband_id='6',
           wife_id='5',
           married=datetime(day=28, month=4, year=2014))
]
_individuals1 = [
    #all should work (complete)
    Individual('1',
               name='Linda /Burger/',
               birthday=datetime(1960, 5, 10, 0, 0),
               death=None,
               spouse='F1'),
    Individual('2',
               name='Bob /Burger/',
               birthday=datetime(1935, 6, 15, 0, 0),
               death=None,
               spouse='F1'),
               name='Jane /Doe/',
               sex='M',
               birthday=datetime(day=2, month=3, year=1962)),
    Individual('e',
               name='Ava /White/',
               sex='M',
               birthday=datetime(day=1, month=4, year=1985)),
    Individual('f',
               name='Maria /White/',
               sex='F',
               birthday=datetime(day=9, month=10, year=1988)),
    Individual('g',
               name='Ken /White/',
               sex='F',
               birthday=datetime(day=30, month=1, year=1946)),
    Individual('h',
               name='Ana /White/',
               sex='M',
               birthday=datetime(day=3, month=5, year=1940))
]

_families = [
    Family('F1', husband_id='c', wife_id='d', children=['1', '2']),
    Family('F2', husband_id='g', wife_id='h', children=['5', '6'])
]

two_husb_and_wife_incorrect = Tree()

[two_husb_and_wife_incorrect.add_individual(i) for i in _individuals]
[two_husb_and_wife_incorrect.add_family(f) for f in _families]
Exemple #7
0
from datetime import datetime

from lib.GedObjects import Tree
from lib.GedObjects import Family
from lib.GedObjects import Individual

_individuals = [
    Individual('1a1a', name='Evan /Doe/', sex='M', birthday=datetime(day=12, month=4, year=1998)),
    Individual('2b2b', name='Elena /Doe/', sex='F', birthday=datetime(day=15, month=9, year=2000)),
    Individual('3c3c', name='John /Doe/', sex='F', birthday=datetime(day=2, month=3, year=1962)),
    Individual('4d4d', name='Jane /Doe/', sex='F', birthday=datetime(day=2, month=3, year=1962)),
    Individual('5e5e', name='Ava /White/', sex='M', birthday=datetime(day=1, month=4, year=1985)),
    Individual('6f6f', name='Maria /White/', sex='F', birthday=datetime(day=9, month=10, year=1988)),
    Individual('7g7g', name='Ken /White/', sex='M', birthday=datetime(day=30, month=1, year=1946)),
    Individual('8h8h', name='Ana /White/', sex='F', birthday=datetime(day=3, month=5, year=1940))   
]

_families = [
    Family('F1', husband_id='3c3c', wife_id='4d4d', children=['1', '2']),
    Family('F2', husband_id='7g7g', wife_id='8h8h', children=['5', '6'])
]

husband_incorrect = Tree()

[husband_incorrect .add_individual(i) for i in _individuals]
[husband_incorrect .add_family(f) for f in _families]
Exemple #8
0
               name='Hannah /Montana/',
               sex='F',
               birthday=datetime(day=30, month=12, year=1996)),
    Individual('3',
               name='Ethan /Evans/',
               sex='M',
               birthday=datetime(day=8, month=3, year=1970),
               death=datetime(day=23, month=5, year=2018)),
    Individual('4',
               name='Leslie /Maple/',
               sex='F',
               birthday=datetime(day=12, month=9, year=1950))
]

_families = [
    Family('F1', married=datetime(1973, 4, 11, 0, 0)),
    Family('F2',
           married=datetime(2000, 10, 31, 0, 0),
           divorced=datetime(2007, 12, 25, 0, 0))
]
correct_dates = Tree()
[correct_dates.add_individual(i) for i in _individuals]
[correct_dates.add_family(f) for f in _families]
"""Tree for Test Case 2"""
_individuals1 = [
    Individual('1',
               name='Super /Man/',
               sex='M',
               birthday=datetime(day=28, month=1, year=1954),
               death=datetime(day=5, month=11, year=2017)),
    Individual('2',
Exemple #9
0
               birthday=datetime(day=23, month=3, year=1999)),
    Individual('4',
               name='Fonty /Python/',
               sex='F',
               birthday=datetime(day=23, month=3, year=1999)),
    Individual('5',
               name='Lonty /Python/',
               sex='M',
               birthday=datetime(day=23, month=3, year=1999)),
    Individual('6',
               name='Zonty /Python/',
               sex='F',
               birthday=datetime(day=23, month=3, year=1999)),
]

_families = [Family('F1', children=['1', '2', '3', '4', '5', '6'])]

sextuplet_check = Tree()

[sextuplet_check.add_individual(i) for i in _individuals]
[sextuplet_check.add_family(f) for f in _families]

_individuals2 = [
    Individual('1',
               name='Monty /Python//',
               sex='M',
               birthday=datetime(day=23, month=3, year=1999)),
    Individual('2',
               name='Ronty /Python/',
               sex='F',
               birthday=datetime(day=23, month=3, year=1998)),
Exemple #10
0
               name='Jane /Doe/',
               sex='M',
               birthday=datetime(day=2, month=3, year=1962)),  # 4444 is wrong
    Individual('5555',
               name='Ava /White/',
               sex='M',
               birthday=datetime(day=1, month=4, year=1985)),
    Individual('6666',
               name='Maria /White/',
               sex='F',
               birthday=datetime(day=9, month=10, year=1988)),
    Individual('7777',
               name='Ken /White/',
               sex='M',
               birthday=datetime(day=30, month=1, year=1946)),
    Individual('8888',
               name='Ana /White/',
               sex='F',
               birthday=datetime(day=3, month=5, year=1940))
]

_families = [
    Family('F1', husband_id='3333', wife_id='4444', children=['1', '2']),
    Family('F2', husband_id='7777', wife_id='8888', children=['5', '6'])
]

wife_incorrect = Tree()

[wife_incorrect.add_individual(i) for i in _individuals]
[wife_incorrect.add_family(f) for f in _families]
Exemple #11
0
    def evaluate(self, tree: Tree, level: int, tag: str, args: str):
        """
        Evaluate a valid line and add information to the tree if necessary
        :param tree: The Tree currently being built
        :param level: (unused) The level of the line to evaluate
        :param tag: The tag of the line to evaluate
        :param args: The args of the line to evaluate
        :return: None
        """
        # If we are creating an individual and the next tag is invalid for an individual
        if self._creating_indi and (tag in Builder.FAMILY_TAGS
                                    or tag in Builder.TOP_LEVEL_TAGS):
            self._creating_indi = False
            # Try to add the individual
            try:
                tree.add_individual(Individual(**self._current_indi_data))
            except (TypeError, DuplicateIndividualException):
                logging.log(logging.DEBUG, traceback.format_exc())

            self._current_indi_data = {}

        # If we are creating a family and the next tag is invalid for a family
        elif self._creating_fam and (tag in Builder.INDIVIDUAL_TAGS
                                     or tag in Builder.TOP_LEVEL_TAGS):
            self._creating_fam = False
            # Try to add the family
            try:
                tree.add_family(Family(**self._current_fam_data))
            except (TypeError, DuplicateFamilyException):
                logging.log(logging.DEBUG, traceback.format_exc())

            self._current_fam_data = {'children': []}

        # If we are creating some kind of date and the next tag is not 'DATE' or is invalid
        elif True in (self._creating_birth, self._creating_death,
                      self._creating_marr,
                      self._creating_div) and (tag != 'DATE'):
            self._creating_birth, self._creating_death, self._creating_marr, self._creating_div = False, False, False, False

        # Basic cases for each tag
        if tag == 'INDI':
            self._creating_indi = True
            self._current_indi_data['id'] = args
        elif tag == 'FAM':
            self._creating_fam = True
            self._current_fam_data['id'] = args
        elif tag == 'NAME' and self._creating_indi:
            self._current_indi_data['name'] = args
        elif tag == 'SEX' and self._creating_indi:
            self._current_indi_data['sex'] = args
        elif tag == 'BIRT' and self._creating_indi:
            self._creating_birth = True
        elif tag == 'DEAT' and self._creating_indi:
            self._creating_death = True
        elif tag == 'MARR' and self._creating_fam:
            self._creating_marr = True
        elif tag == 'DIV' and self._creating_fam:
            self._creating_div = True
        elif tag == 'DATE':
            timestamp = datetime.strptime(args, '%d %b %Y')
            if self._creating_birth:
                self._current_indi_data['birthday'] = timestamp
            elif self._creating_death:
                self._current_indi_data['death'] = timestamp
            elif self._creating_marr:
                self._current_fam_data['married'] = timestamp
            elif self._creating_div:
                self._current_fam_data['divorced'] = timestamp
        elif tag == 'FAMC' and self._creating_indi:
            self._current_indi_data['child'] = args
        elif tag == 'FAMS' and self._creating_indi:
            self._current_indi_data['spouse'] = args
        elif tag == 'HUSB' and self._creating_fam:
            self._current_fam_data['husband_id'] = args
        elif tag == 'WIFE' and self._creating_fam:
            self._current_fam_data['wife_id'] = args
        elif tag == 'CHIL' and self._creating_fam:
            self._current_fam_data['children'].append(args)
        elif tag == 'HEAD':
            pass
        elif tag == 'TRLR':
            pass
        elif tag == 'NOTE':
            pass
Exemple #12
0
               sex='F',
               birthday=datetime(day=10, month=8, year=1975)),
    Individual('9',
               name='Snow /White',
               sex='F',
               birthday=datetime(day=6, month=1, year=1996)),
    Individual('10',
               name='Prince /Charming',
               sex='M',
               birthday=datetime(day=13, month=4, year=1993))
]

_families = [
    Family('F1',
           husband_id='1',
           wife_id='2',
           children=['3'],
           married=datetime(day=1, month=1, year=1963)),
    Family('F2',
           husband_id='4',
           wife_id='5',
           children=['6', '7', '8'],
           married=datetime(day=3, month=5, year=1967)),
    Family('F3',
           husband_id='10',
           wife_id='9',
           married=datetime(day=24, month=12, year=2018))
]

of_age = Tree()