コード例 #1
0
 def setUp(self, *args):
     super(MakoFormatterTests, self).setUp()
     fctr = gctr = sctr = actr = pctr = 0
     for f in xrange(2):
         fctr += 1
         family = Family(id=fctr, epithet=u'fam%s' % fctr)
         self.session.add(family)
         for g in range(2):
             gctr += 1
             genus = Genus(id=gctr, family=family, epithet=u'gen%s' % gctr)
             self.session.add(genus)
             for s in range(2):
                 sctr += 1
                 sp = Species(id=sctr, genus=genus, epithet=u'sp%s' % sctr)
                 # TODO: why doesn't this geography, species
                 # distribution stuff seem to work
                 geo = Geography(id=sctr, name=u'Mexico%s' % sctr)
                 dist = SpeciesDistribution(geography_id=sctr)
                 sp.distribution.append(dist)
                 vn = VernacularName(id=sctr,
                                     species=sp,
                                     name=u'name%s' % sctr)
                 self.session.add_all([sp, geo, dist, vn])
                 for a in range(2):
                     actr += 1
                     acc = Accession(id=actr, species=sp, code=u'%s' % actr)
                     self.session.add(acc)
                     for p in range(2):
                         pctr += 1
                         loc = Location(id=pctr,
                                        code=u'%s' % pctr,
                                        name=u'site%s' % pctr)
                         plant = Plant(id=pctr,
                                       accession=acc,
                                       location=loc,
                                       code=u'%s' % pctr,
                                       quantity=1)
                         #debug('fctr: %s, gctr: %s, actr: %s, pctr: %s' \
                         #      % (fctr, gctr, actr, pctr))
                         self.session.add_all([loc, plant])
     self.session.commit()
コード例 #2
0
 def setUp(self):
     super(ReportTests, self).setUp()
     fctr = gctr = sctr = actr = pctr = 0
     for f in xrange(2):
         fctr += 1
         family = Family(id=fctr, epithet=u'fam%s' % fctr)
         self.session.add(family)
         for g in range(2):
             gctr += 1
             genus = Genus(id=gctr, family=family, epithet=u'gen%s' % gctr)
             self.session.add(genus)
             for s in range(2):
                 sctr += 1
                 sp = Species(id=sctr, genus=genus, epithet=u'sp%s' % sctr)
                 vn = VernacularName(id=sctr,
                                     species=sp,
                                     name=u'name%s' % sctr)
                 self.session.add_all([sp, vn])
                 for a in range(2):
                     actr += 1
                     acc = Accession(id=actr, species=sp, code=u'%s' % actr)
                     self.session.add(acc)
                     for p in range(2):
                         pctr += 1
                         loc = Location(id=pctr,
                                        code=u'%s' % pctr,
                                        name=u'site%s' % pctr)
                         plant = Plant(id=pctr,
                                       accession=acc,
                                       location=loc,
                                       code=u'%s' % pctr,
                                       quantity=1)
                         #debug('fctr: %s, gctr: %s, actr: %s, pctr: %s' \
                         #      % (fctr, gctr, actr, pctr))
                         self.session.add_all([loc, plant])
     self.session.commit()