* src/plugins/TestcaseGenerator.py: Update to new tuple types

svn: r4876
This commit is contained in:
Martin Hawlisch 2005-06-24 22:12:30 +00:00
parent 1cf3a2a99c
commit 258a3f4f95
2 changed files with 25 additions and 24 deletions

View File

@ -1,6 +1,7 @@
2005-06-24 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/GrampsBSDDB.py (upgrade): Disable upgrade_7 until this is
properly working to not accidently destroy a database from gramps20
* src/plugins/TestcaseGenerator.py: Update to new tuple types
2005-06-20 Don Allingham <don@gramps-project.org>
* src/GenericFilter.py: optimize looping and reducing fetches

View File

@ -299,7 +299,7 @@ class TestcaseGenerator:
fam = RelLib.Family()
fam.set_father_handle(person1_h)
fam.set_mother_handle(person2_h)
fam.set_relationship(RelLib.Family.MARRIED)
fam.set_relationship((RelLib.Family.MARRIED,''))
fam_h = self.db.add_family(fam,self.trans)
#person1 = self.db.get_person_from_handle(person1_h)
#person1.add_family_handle(fam_h)
@ -315,7 +315,7 @@ class TestcaseGenerator:
fam = RelLib.Family()
#fam.set_father_handle(person1_h)
fam.set_mother_handle(person2_h)
fam.set_relationship(RelLib.Family.MARRIED)
fam.set_relationship((RelLib.Family.MARRIED,''))
fam_h = self.db.add_family(fam,self.trans)
person1 = self.db.get_person_from_handle(person1_h)
person1.add_family_handle(fam_h)
@ -331,7 +331,7 @@ class TestcaseGenerator:
fam = RelLib.Family()
fam.set_father_handle(person1_h)
#fam.set_mother_handle(person2_h)
fam.set_relationship(RelLib.Family.MARRIED)
fam.set_relationship((RelLib.Family.MARRIED,''))
fam_h = self.db.add_family(fam,self.trans)
person1 = self.db.get_person_from_handle(person1_h)
person1.add_family_handle(fam_h)
@ -347,7 +347,7 @@ class TestcaseGenerator:
fam = RelLib.Family()
fam.set_father_handle(person1_h)
fam.set_mother_handle(person2_h)
fam.set_relationship(RelLib.Family.MARRIED)
fam.set_relationship((RelLib.Family.MARRIED,''))
fam_h = self.db.add_family(fam,self.trans)
person1 = self.db.get_person_from_handle(person1_h)
person1.add_family_handle(fam_h)
@ -363,7 +363,7 @@ class TestcaseGenerator:
fam = RelLib.Family()
fam.set_father_handle(person1_h)
fam.set_mother_handle(person2_h)
fam.set_relationship(RelLib.Family.MARRIED)
fam.set_relationship((RelLib.Family.MARRIED,''))
fam_h = self.db.add_family(fam,self.trans)
person1 = self.db.get_person_from_handle(person1_h)
person1.add_family_handle(fam_h)
@ -379,7 +379,7 @@ class TestcaseGenerator:
fam = RelLib.Family()
fam.set_father_handle("InvalidHandle1")
fam.set_mother_handle(person2_h)
fam.set_relationship(RelLib.Family.MARRIED)
fam.set_relationship((RelLib.Family.MARRIED,''))
fam_h = self.db.add_family(fam,self.trans)
#person1 = self.db.get_person_from_handle(person1_h)
#person1.add_family_handle(fam_h)
@ -395,7 +395,7 @@ class TestcaseGenerator:
fam = RelLib.Family()
fam.set_father_handle(person1_h)
fam.set_mother_handle("InvalidHandle2")
fam.set_relationship(RelLib.Family.MARRIED)
fam.set_relationship((RelLib.Family.MARRIED,''))
fam_h = self.db.add_family(fam,self.trans)
person1 = self.db.get_person_from_handle(person1_h)
person1.add_family_handle(fam_h)
@ -413,7 +413,7 @@ class TestcaseGenerator:
fam = RelLib.Family()
fam.set_father_handle(person1_h)
fam.set_mother_handle(person2_h)
fam.set_relationship(RelLib.Family.MARRIED)
fam.set_relationship((RelLib.Family.MARRIED,''))
fam.add_child_handle(child_h)
fam_h = self.db.add_family(fam,self.trans)
person1 = self.db.get_person_from_handle(person1_h)
@ -434,7 +434,7 @@ class TestcaseGenerator:
fam = RelLib.Family()
fam.set_father_handle(person1_h)
fam.set_mother_handle(person2_h)
fam.set_relationship(RelLib.Family.MARRIED)
fam.set_relationship((RelLib.Family.MARRIED,''))
#fam.add_child_handle(child_h)
fam_h = self.db.add_family(fam,self.trans)
person1 = self.db.get_person_from_handle(person1_h)
@ -444,7 +444,7 @@ class TestcaseGenerator:
person2.add_family_handle(fam_h)
self.db.commit_person(person2,self.trans)
child = self.db.get_person_from_handle(child_h)
child.add_parent_family_handle(fam_h,RelLib.Person.CHILD_BIRTH,RelLib.Person.CHILD_BIRTH)
child.add_parent_family_handle(fam_h,(RelLib.Person.CHILD_BIRTH,''),(RelLib.Person.CHILD_BIRTH,''))
self.db.commit_person(child,self.trans)
self.commit_transaction() # COMMIT TRANSACTION STEP
@ -460,7 +460,7 @@ class TestcaseGenerator:
event_h = self.db.add_event(event,self.trans)
event_ref = RelLib.EventRef()
event_ref.set_reference_handle(event_h)
event_ref.set_role(RelLib.EventRef.PRIMARY)
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
person = self.db.get_person_from_handle(person_h)
person.add_event_ref(event_ref)
self.db.commit_person(person,self.trans)
@ -471,7 +471,7 @@ class TestcaseGenerator:
person = self.db.get_person_from_handle(person_h)
event_ref = RelLib.EventRef()
event_ref.set_reference_handle("InvalidHandle4")
event_ref.set_role(RelLib.EventRef.PRIMARY)
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
person.set_birth_ref(event_ref)
self.db.commit_person(person,self.trans)
self.commit_transaction() # COMMIT TRANSACTION STEP
@ -481,7 +481,7 @@ class TestcaseGenerator:
person = self.db.get_person_from_handle(person_h)
event_ref = RelLib.EventRef()
event_ref.set_reference_handle("InvalidHandle5")
event_ref.set_role(RelLib.EventRef.PRIMARY)
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
person.set_death_ref(event_ref)
self.db.commit_person(person,self.trans)
self.commit_transaction() # COMMIT TRANSACTION STEP
@ -491,7 +491,7 @@ class TestcaseGenerator:
person = self.db.get_person_from_handle(person_h)
event_ref = RelLib.EventRef()
event_ref.set_reference_handle("InvalidHandle6")
event_ref.set_role(RelLib.EventRef.PRIMARY)
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
person.add_event_ref(event_ref)
self.db.commit_person(person,self.trans)
self.commit_transaction() # COMMIT TRANSACTION STEP
@ -503,7 +503,7 @@ class TestcaseGenerator:
event_h = self.db.add_event(event,self.trans)
event_ref = RelLib.EventRef()
event_ref.set_reference_handle(event_h)
event_ref.set_role(RelLib.EventRef.PRIMARY)
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
person = self.db.get_person_from_handle(person_h)
person.set_birth_ref(event_ref)
self.db.commit_person(person,self.trans)
@ -516,7 +516,7 @@ class TestcaseGenerator:
event_h = self.db.add_event(event,self.trans)
event_ref = RelLib.EventRef()
event_ref.set_reference_handle(event_h)
event_ref.set_role(RelLib.EventRef.PRIMARY)
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
person = self.db.get_person_from_handle(person_h)
person.set_death_ref(event_ref)
self.db.commit_person(person,self.trans)
@ -529,7 +529,7 @@ class TestcaseGenerator:
event_h = self.db.add_event(event,self.trans)
event_ref = RelLib.EventRef()
event_ref.set_reference_handle(event_h)
event_ref.set_role(RelLib.EventRef.PRIMARY)
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
person = self.db.get_person_from_handle(person_h)
person.add_event_ref(event_ref)
self.db.commit_person(person,self.trans)
@ -604,7 +604,7 @@ class TestcaseGenerator:
bevent_h = self.db.add_event(bevent,self.trans)
bevent_ref = RelLib.EventRef()
bevent_ref.set_reference_handle(bevent_h)
bevent_ref.set_role(RelLib.EventRef.PRIMARY)
bevent_ref.set_role((RelLib.EventRef.PRIMARY,''))
# for the death event display the date as text and parse it back to a new date
ndate = None
try:
@ -632,7 +632,7 @@ class TestcaseGenerator:
devent_h = self.db.add_event(devent,self.trans)
devent_ref = RelLib.EventRef()
devent_ref.set_reference_handle(devent_h)
devent_ref.set_role(RelLib.EventRef.PRIMARY)
devent_ref.set_role((RelLib.EventRef.PRIMARY,''))
person_h = self.generate_person(None, "DateTest")
person = self.db.get_person_from_handle(person_h)
person.set_birth_ref(bevent_ref)
@ -712,7 +712,7 @@ class TestcaseGenerator:
self.add_defaults(fam)
fam.set_father_handle(person1_h)
fam.set_mother_handle(person2_h)
fam.set_relationship(RelLib.Family.MARRIED)
fam.set_relationship((RelLib.Family.MARRIED,''))
fam_h = self.db.add_family(fam,self.trans)
fam = self.db.commit_family(fam,self.trans)
person1 = self.db.get_person_from_handle(person1_h)
@ -730,7 +730,7 @@ class TestcaseGenerator:
fam.add_child_handle(child_h)
self.db.commit_family(fam,self.trans)
child = self.db.get_person_from_handle(child_h)
child.add_parent_family_handle(fam_h,RelLib.Person.CHILD_BIRTH,RelLib.Person.CHILD_BIRTH)
child.add_parent_family_handle(fam_h,(RelLib.Person.CHILD_BIRTH,''),(RelLib.Person.CHILD_BIRTH,''))
self.db.commit_person(child,self.trans)
if randint(0,3) > 0:
self.persons_todo.append(child_h)
@ -756,7 +756,7 @@ class TestcaseGenerator:
fam = RelLib.Family()
fam.set_father_handle(person1_h)
fam.set_mother_handle(person2_h)
fam.set_relationship(RelLib.Family.MARRIED)
fam.set_relationship((RelLib.Family.MARRIED,''))
fam.add_child_handle(child_h)
fam_h = self.db.add_family(fam,self.trans)
fam = self.db.commit_family(fam,self.trans)
@ -767,7 +767,7 @@ class TestcaseGenerator:
person2.add_family_handle(fam_h)
self.db.commit_person(person2,self.trans)
child.add_parent_family_handle(fam_h,RelLib.Person.CHILD_BIRTH,RelLib.Person.CHILD_BIRTH)
child.add_parent_family_handle(fam_h,(RelLib.Person.CHILD_BIRTH,''),(RelLib.Person.CHILD_BIRTH,''))
self.db.commit_person(child,self.trans)
self.commit_transaction() # COMMIT TRANSACTION STEP
@ -780,7 +780,7 @@ class TestcaseGenerator:
event_h = self.db.add_event(e, self.trans)
event_ref = RelLib.EventRef()
event_ref.set_reference_handle(event_h)
event_ref.set_role(RelLib.EventRef.PRIMARY)
event_ref.set_role((RelLib.EventRef.PRIMARY,''))
object.add_event_ref(event_ref)
def commit_transaction(self):