feat: extract place lat/long coordinates #7
No files matched your search
+2
-1
@@ -211,9 +211,10 @@ class Individual:
|
||||
- children: List of Individual objects
|
||||
"""
|
||||
families = []
|
||||
# Cache the subject pointer once; it doesn't change across families.
|
||||
self_pointer = self.element.get_pointer()
|
||||
for family in self.gedcom.get_families(self.element):
|
||||
# Get partner
|
||||
self_pointer = self.element.get_pointer()
|
||||
partners = [
|
||||
Individual(parent, self.gedcom)
|
||||
for parent in self.gedcom.get_family_members(family, "PARENTS")
|
||||
|
||||
@@ -17,26 +17,6 @@ from gedcom_parser import GedcomParser
|
||||
from individual import Individual
|
||||
|
|
||||
|
||||
|
||||
class TestIndividualBasicInfo:
|
||||
"""Tests for basic individual information extraction."""
|
||||
|
||||
@pytest.fixture
|
||||
def john_doe(self, sample_gedcom_file):
|
||||
"""Get the John Doe individual from sample GEDCOM."""
|
||||
parser = GedcomParser(sample_gedcom_file)
|
||||
individuals = parser.get_individuals()
|
||||
"""
|
||||
Tests for the Individual data model.
|
||||
|
||||
This module tests individual person data extraction including:
|
||||
- Names and IDs
|
||||
- Birth and death information
|
||||
- Events and attributes
|
||||
- Family relationships
|
||||
- Images and notes
|
||||
- Custom story tags
|
||||
"""
|
||||
|
||||
class TestIndividualBasicInfo:
|
||||
"""Tests for basic individual information extraction."""
|
||||
|
||||
@@ -350,10 +330,6 @@ class TestEvents:
|
||||
events = person.get_events()
|
||||
event_types = [e['type'] for e in events]
|
||||
|
||||
assert resi['place'] == 'Deepplace'
|
||||
assert resi['lat'] == '48.8566'
|
||||
assert resi['long'] == '2.3522'
|
||||
|
||||
|
||||
class TestFamilyRelationships:
|
||||
"""Tests for family relationship extraction."""
|
||||
@@ -601,8 +577,6 @@ class TestAttributes:
|
||||
attrs = person.get_attributes()
|
||||
assert len(attrs) == 0
|
||||
|
||||
return Individual(john[0], parser.parser)
|
||||
|
||||
def test_get_id(self, john_doe):
|
||||
"""Test ID extraction without @ symbols."""
|
||||
id_value = john_doe.get_id()
|
||||
|
||||
Reference in new issue
Block a user
The
john_doefixture inside the firstTestIndividualBasicInfoblock contains an unrelated triple-quoted module docstring (lines 28–38) and never returns anIndividual, and the class name is then redefined again immediately after. This looks like an accidental paste and makes the test module confusing to maintain; please remove this stray block (or make the fixture return the expectedIndividual) and keep only oneTestIndividualBasicInfodefinition.⚠️ Potential issue | 🔴 Critical
Blocker: file is structurally broken from a bad merge/rebase.
This file cannot be imported by pytest as-is. Multiple issues:
Lines 20–40:
TestIndividualBasicInfois declared twice. The first declaration'sjohn_doefixture opens a triple-quoted string at Line 28 (appears to be the module docstring accidentally inlined) and never returns, then a secondclass TestIndividualBasicInfostarts at Line 40.Lines 353–355 (inside
test_get_events_coords_nested_structure): asserts referenceresi, but onlyevent_typesis assigned on Line 351.resiis undefined here (Ruff F821). Theresi = [e for e in events if e["type"] == "RESI"][0]line is missing.Line 604: an orphan
return Individual(john[0], parser.parser)sits at class-body scope insideTestAttributes, wherejohnis undefined (Ruff F821). It's a leftover from the duplicatedjohn_doefixture below.Lines 604–1135: The entire suite (
TestIndividualBasicInfo,TestBirthAndDeath,TestEvents,TestFamilyRelationships,TestImagesAndMedia,TestStories) is duplicated verbatim afterTestAttributes. In this second copy,TestImagesAndMedia.test_get_images(Line 1037–1047) actually callsget_notesand asserts note content — it's the wrong body pasted in.Please re-do the diff so only a single, clean copy of each class exists, and re-add the missing
resi = [e for e in events if e["type"] == "RESI"][0]assignment intest_get_events_coords_nested_structure(consider usingnext(...)per the Ruff RUF015 hint).🔧 Fix for the missing resi assignment (Lines 350–355)
🤖 Prompt for AI Agents
✅ Addressed in commits
747175fto0ba00d0The file defines
TestIndividualBasicInfotwice, and this firstjohn_doefixture appears to contain an accidentally pasted triple-quoted block and never returns anIndividualinstance. Please remove the stray block and keep a singleTestIndividualBasicInfodefinition with a fixture that returns the intended individual, to avoid dead/overwritten test code and confusing fixture behavior.