fix: cache subject pointer; tidy up tests

Cache the subject pointer in Individual.get_families by calling self.element.get_pointer() once outside the loop to avoid repeated calls and add a clarifying comment. Clean up tests: remove a duplicated TestIndividualBasicInfo fixture/block comment, drop redundant assertions about residence coordinates, and remove an unnecessary return in TestAttributes.
This commit is contained in:
Jared Howland committed 2026-04-16 22:51:45 -06:00
1 parent 2108325252
commit 747175fcef
2 files changed
+2 -27

No files matched your search

+2 -1
View File
@@ -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")