Example #1
0
def test_n_rows_returned_when_born_beetween_called_with_valid_arg():
    n = 4
    from_date = datetime.strptime('1964-01-01', '%Y-%m-%d')
    to_date = datetime.strptime('1966-01-01', '%Y-%m-%d')
    res = PersonService.born_between(from_date, to_date)
    res = list(r for r in res)
    assert len(res) == n
Example #2
0
def get_persons_born(date_from, date_to):
    try:
        persons = PersonService.born_between(date_from, date_to)
        for p in persons:
            print("{} {}, born: {}".format(p.name_first, p.name_last, p.dob_date))
    except OperationalError:
        print('Database is empty please download some persons first')