feat: add FamilySearch ID to frontmatter #6

Open
jaredhowland wants to merge 3 commits from jaredhowland/add-family-search-id-parsing into main
pull from: jaredhowland/add-family-search-id-parsing
Showing only changes of commit a56792ae0d - Show all commits
+7 -1
View File
@@ -80,10 +80,16 @@ class TestIndividualBasicInfo:
"""Test gender extraction.""" """Test gender extraction."""
assert john_doe.get_gender() == 'M' assert john_doe.get_gender() == 'M'
def test_get_fs_id(self, john_doe): def test_get_fs_id(self, john_doe, sample_gedcom_file):
"""Test FamilySearch Tree ID extraction from _FSFTID tag.""" """Test FamilySearch Tree ID extraction from _FSFTID tag."""
assert john_doe.get_fs_id() == 'G123-ABC' assert john_doe.get_fs_id() == 'G123-ABC'
copilot-pull-request-reviewer[bot] commented 2026-04-16 21:56:56 +02:00 (Migrated from github.com)
Review

test_get_fs_id only covers the case where _FSFTID is present. Add a complementary test that builds a minimal GEDCOM without _FSFTID and asserts get_fs_id() returns an empty string (and/or that frontmatter omits the field) to prevent regressions in the default/absent-tag behavior.


    def test_get_fs_id_missing_returns_empty_string(self, sample_gedcom_file):
        """Test that missing _FSFTID defaults to an empty string."""
        gedcom_content = """0 HEAD
1 SOUR TestApp
1 GEDC
2 VERS 5.5.1
1 CHAR UTF-8
0 @I1@ INDI
1 NAME Test /Person/
0 TRLR
"""
        temp_file = sample_gedcom_file.parent / "no_fsftid.ged"
        temp_file.write_text(gedcom_content, encoding='utf-8')

        parser = GedcomParser(temp_file)
        individuals = parser.get_individuals()
        person = Individual(individuals[0], parser.parser)

        assert person.get_fs_id() == ''
`test_get_fs_id` only covers the case where `_FSFTID` is present. Add a complementary test that builds a minimal GEDCOM without `_FSFTID` and asserts `get_fs_id()` returns an empty string (and/or that frontmatter omits the field) to prevent regressions in the default/absent-tag behavior. ```suggestion def test_get_fs_id_missing_returns_empty_string(self, sample_gedcom_file): """Test that missing _FSFTID defaults to an empty string.""" gedcom_content = """0 HEAD 1 SOUR TestApp 1 GEDC 2 VERS 5.5.1 1 CHAR UTF-8 0 @I1@ INDI 1 NAME Test /Person/ 0 TRLR """ temp_file = sample_gedcom_file.parent / "no_fsftid.ged" temp_file.write_text(gedcom_content, encoding='utf-8') parser = GedcomParser(temp_file) individuals = parser.get_individuals() person = Individual(individuals[0], parser.parser) assert person.get_fs_id() == '' ```
parser = GedcomParser(sample_gedcom_file)
individuals = parser.get_individuals()
jane = [ind for ind in individuals if 'Jane' in str(ind.get_name())]
jane_doe = Individual(jane[0], parser.parser)
assert jane_doe.get_fs_id() == ''
def test_get_gender_default_unknown(self, sample_gedcom_file): def test_get_gender_default_unknown(self, sample_gedcom_file):
"""Test that missing gender defaults to 'U'.""" """Test that missing gender defaults to 'U'."""
gedcom_content = """0 HEAD gedcom_content = """0 HEAD