From: Don A. <dal...@us...> - 2003-01-08 05:06:11
|
I had started on a test suite. Being a GUI based program, creating a regression test is a bit difficult. I have the start of a GEDCOM test which is loaded as a plugin, however, it is far from done. Eventually, I'll get a regression suite developed. With additional help, it can get done a lot sooner. Any volunteers? Alexandre - I have committed the patches and verified that they seem to work. Don On Tue, 2003-01-07 at 14:25, Alexandre Duret-Lutz wrote: > This fixes some GEDCOM-export bugs I've seen. > > A couple of issues come from my source_refs patch, which was > against the 0.8.x branch (sorry I forgot to mention it), and > needed some adjustments for 0.9.x. > > The I've removed the try/except around parse.parse(f) because > it was hiding bugs in GedcomInfoParser and gedcom.xml. > > I wish gramps had a test suite. All these bugs would be easy to > catch with a simple test that loads a GEDCOM file and writes it > back. In this case the plug-in even failed to load. > > Index: GedcomInfo.py > =================================================================== > RCS file: /cvsroot/gramps/gramps2/src/GedcomInfo.py,v > retrieving revision 1.4 > diff -u -r1.4 GedcomInfo.py > --- GedcomInfo.py 3 Jan 2003 03:19:50 -0000 1.4 > +++ GedcomInfo.py 7 Jan 2003 21:04:14 -0000 > @@ -141,19 +141,16 @@ > > self.standard = GedcomDescription("GEDCOM 5.5 standard") > self.standard.set_dest("GEDCOM 5.5") > - > + > try: > file = "%s/gedcom.xml" % const.dataDir > f = open(file,"r") > except: > return > - > - try: > - parser = GedInfoParser(self) > - parser.parse(f) > - f.close() > - except: > - pass > + > + parser = GedInfoParser(self) > + parser.parse(f) > + f.close() > > def add_description(self,name,obj): > self.map[name] = obj > @@ -198,6 +195,7 @@ > elif tag == "dest": > self.current.set_dest(attrs['val']) > elif tag == "adopt": > + val = attrs['val'] > if val == 'none': > self.current.set_adopt(ADOPT_NONE) > elif val == 'event': > @@ -212,6 +210,7 @@ > if attrs['val'] == 'broken': > self.current.set_conc(CONC_BROKEN) > elif tag == "alternate_names": > + val = attrs['val'] > if val == 'none': > self.current.set_alt_name(ALT_NAME_NONE) > elif val == 'event_aka': > @@ -237,5 +236,5 @@ > if attrs['val'] == 'place': > self.current.set_resi(RESIDENCE_PLAC) > elif tag == "source_refs": > - if u2l(attrs['val']) == 'no': > + if attrs['val'] == 'no': > self.current.set_source_refs(SOURCE_REFS_NO) > Index: data/gedcom.xml > =================================================================== > RCS file: /cvsroot/gramps/gramps2/src/data/gedcom.xml,v > retrieving revision 1.3 > diff -u -r1.3 gedcom.xml > --- data/gedcom.xml 3 Jan 2003 03:19:50 -0000 1.3 > +++ data/gedcom.xml 7 Jan 2003 21:04:26 -0000 > @@ -5,7 +5,7 @@ > <adopt val="none"/> > <conc val="standard"/> > <alternate_names val="none"/> > - <prefix val="no"> > + <prefix val="no"/> > <calendar val="no"/> > <extended_events> > </extended_events> > @@ -18,7 +18,7 @@ > <adopt val="event"/> > <conc val="broken"/> > <alternate_names val="event_aka"/> > - <prefix val="no"> > + <prefix val="no"/> > <calendar val="no"/> > <extended_events> > </extended_events> > @@ -31,7 +31,7 @@ > <adopt val="ftw"/> > <conc val="broken"/> > <alternate_names val="alias"/> > - <prefix val="no"> > + <prefix val="no"/> > <calendar val="no"/> > <extended_events> > <event tag="_DEG" value="Degree"/> > @@ -48,7 +48,7 @@ > <adopt val="none"/> > <conc val="broken"/> > <alternate_names val="none"/> > - <prefix val="no"> > + <prefix val="no"/> > <calendar val="no"/> > <extended_events> > </extended_events> > @@ -61,7 +61,7 @@ > <adopt val="event_extended"/> > <conc val="standard"/> > <alternate_names val="none"/> > - <prefix val="no"> > + <prefix val="no"/> > <calendar val="yes"/> > <extended_events> > </extended_events> > @@ -73,7 +73,7 @@ > <dest val="Legacy"/> > <adopt val="legacy"/> > <conc val="broken"/> > - <prefix val="no"> > + <prefix val="no"/> > <alternate_names val="standard"/> > <calendar val="no"/> > <extended_events> > @@ -87,7 +87,7 @@ > <adopt val="pedigree"/> > <conc val="standard"/> > <alternate_names val="aka"/> > - <prefix val="no"> > + <prefix val="no"/> > <calendar val="no"/> > <extended_events> > </extended_events> > @@ -100,7 +100,7 @@ > <adopt val="none"/> > <conc val="broken"/> > <alternate_names val="none"/> > - <prefix val="no"> > + <prefix val="no"/> > <calendar val="no"/> > <extended_events> > </extended_events> > @@ -113,7 +113,7 @@ > <adopt val="none"/> > <conc val="broken"/> > <alternate_names val="_alias"/> > - <prefix val="no"> > + <prefix val="no"/> > <calendar val="no"/> > <extended_events> > </extended_events> > @@ -126,7 +126,7 @@ > <adopt val="none"/> > <conc val="broken"/> > <alternate_names val="none"/> > - <prefix val="no"> > + <prefix val="no"/> > <calendar val="no"/> > <extended_events> > </extended_events> > @@ -135,4 +135,3 @@ > <source_refs val="yes"/> > </target> > </targets> > - > Index: plugins/WriteGedcom.py > =================================================================== > RCS file: /cvsroot/gramps/gramps2/src/plugins/WriteGedcom.py,v > retrieving revision 1.10 > diff -u -r1.10 WriteGedcom.py > --- plugins/WriteGedcom.py 3 Jan 2003 03:19:50 -0000 1.10 > +++ plugins/WriteGedcom.py 7 Jan 2003 21:04:29 -0000 > @@ -49,6 +49,7 @@ > import const > import Utils > import Date > +import Calendar > from intl import gettext as _ > from latin_utf8 import latin_to_utf8 > from GedcomInfo import * > @@ -77,15 +78,15 @@ > "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" ] > > _calmap = { > - Date.HEBREW : (_hmonth, '@#HEBREW@'), > - Date.FRENCH : (_fmonth, '@#FRENCH R@'), > - Date.JULIAN : (_month, '@#JULIAN@'), > + Calendar.Hebrew : (_hmonth, '@#HEBREW@'), > + Calendar.FrenchRepublic : (_fmonth, '@#FRENCH R@'), > + Calendar.Julian : (_month, '@#JULIAN@'), > } > > _caldef = { > - Date.SingleDate.about : "ABT", > - Date.SingleDate.about : "BEF", > - Date.SingleDate.about : "AFT", > + Calendar.ABOUT : "ABT", > + Calendar.BEFORE : "BEF", > + Calendar.AFTER : "AFT", > } > > #------------------------------------------------------------------------- > @@ -168,7 +169,7 @@ > return "%s, %s" % (text,data) > else: > return text > - > + > #------------------------------------------------------------------------- > # > # > @@ -200,6 +201,12 @@ > mon_valid = subdate.getMonthValid() > year_valid = subdate.getYearValid() > > + # Adjust `mon' so it can be used as index in our _Xmonth arrays. > + if mon_valid: > + mon += 1 > + else: > + mon = 0 > + > if _calmap.has_key(subdate.calendar): > (mmap,prefix) = _calmap[subdate.calendar] > else: > @@ -370,11 +377,16 @@ > ans.set_name(_("Ancestors of %s") % person.getPrimaryName().getName()) > ans.add_rule(GenericFilter.IsAncestorOf([person.getId()])) > > - self.filter_menu = GenericFilter.build_filter_menu([all,des,ans]) > + com = GenericFilter.GenericFilter() > + com.set_name(_("People with common ancestor with %s") % > + person.getPrimaryName().getName()) > + com.add_rule(GenericFilter.HasCommonAncestorWith([person.getId()])) > + > + self.filter_menu = GenericFilter.build_filter_menu([all,des,ans,com]) > filter_obj.set_menu(self.filter_menu) > > gedmap = GedcomInfoDB() > - > + > target_obj = self.topDialog.get_widget("target") > myMenu = gtk.Menu() > for name in gedmap.get_name_list(): > @@ -425,9 +437,9 @@ > for p in self.db.getPersonKeys(): > self.plist[p] = 1 > else: > - for p in cfilter.apply(self.db.getPersonMap().values()): > + for p in cfilter.apply(self.db, self.db.getPersonMap().values()): > self.plist[p.getId()] = 1 > - > + > self.flist = {} > self.slist = {} > for key in self.plist.keys(): > @@ -537,8 +549,8 @@ > if self.source_refs: > self.write_sources() > else: > - self.sbar.set_value(100.0) > - > + self.sbar.set_fraction(1.0) > + > self.g.write("0 TRLR\n") > self.g.close() > > @@ -950,10 +962,6 @@ > if ref.getBase() == None: > return > > - self.g.write("%d SOUR @%s@\n" % (level,self.sid(ref.getBase().getId()))) > - if ref.getPage(): > - self.g.write("%d PAGE %s\n" % (level+1,ref.getPage())) > - > if self.source_refs: > self.g.write("%d SOUR @%s@\n" % > (level,self.sid(ref.getBase().getId()))) > @@ -969,9 +977,9 @@ > self.print_date(pfx,ref.getDate()) > else: > # We put title, page, and date on the SOUR line. > - # Not using CONC because GeneWeb does not support this. > + # Not using CONC and CONT because GeneWeb does not support these. > # TEXT and NOTE will be ignored by GeneWeb, but we can't > - # output paragaphs in SOUR if we don't use CONC. > + # output paragaphs in SOUR without CONT. > sbase = ref.getBase() > if sbase and sbase.getTitle(): > txt = sbase.getTitle() + ". " > > -- > Alexandre Duret-Lutz > > > > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! > http://www.vasoftware.com > _______________________________________________ > Gramps-devel mailing list > Gra...@li... > https://lists.sourceforge.net/lists/listinfo/gramps-devel > |