Improves death year extraction and pytest configuration

Fixes death year extraction using regex to correctly parse years
Removes manual sys.path modifications in test files
Adds pythonpath configuration to pytest.ini for simpler imports

Enhances test coverage for life span formatting
This commit is contained in:
AlexKucera committed 2025-11-02 14:35:23 +01:00
1 parent c072ebb2cd
commit 64f42deb29
7 files changed
+39 -24

No files matched your search

+6 -1
View File
@@ -8,6 +8,7 @@ family tree.
from pathlib import Path
from typing import List
import logging
import re
from individual import Individual
@@ -85,7 +86,11 @@ class IndexGenerator:
# Format life span
if birth_info["year"] or death_info["date"]:
death_year = death_info["date"][:4] if death_info["date"] else ""
death_year = ""
if death_info["date"]:
match = re.search(r"(\d{4})\b", death_info["date"])
if match:
death_year = match.group(1)
life_span = f" ({birth_info['year']}-{death_year})"
else:
life_span = ""