Exemplo n.º 1
0
 def testGotRDFa(self):
     """Check HTML output formatter rdfa method returns some text"""
     foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR, f=FOAFSNAPSHOT, uri=FOAF)
     foaf_spec.index()
     page = VocabReport(foaf_spec)
     rdfa = page.rdfa()
     self.failUnless(rdfa)
Exemplo n.º 2
0
 def testGotRDFa(self):
   """Check HTML output formatter rdfa method returns some text"""
   foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR,f=FOAFSNAPSHOT, uri = FOAF)
   foaf_spec.index()
   page = VocabReport(foaf_spec)
   rdfa = page.rdfa()
   self.failUnless(rdfa)
Exemplo n.º 3
0
 def testOutputHTML(self):
     """Check HTML output formatter does something"""
     foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR, f=FOAFSNAPSHOT, uri=FOAF)
     foaf_spec.index()
     page = VocabReport(foaf_spec)
     az = page.az()
     self.failUnless(az)
Exemplo n.º 4
0
 def testOutputHTML(self):
   """Check HTML output formatter does something"""
   foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR,f=FOAFSNAPSHOT, uri = FOAF)
   foaf_spec.index()
   page = VocabReport(foaf_spec)
   az = page.az()
   self.failUnless(az)
Exemplo n.º 5
0
  def testSimpleReport(self):
    """Use the template to generate a simple test report in txt."""
    foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR,f=FOAFSNAPSHOT, uri = FOAF)
    foaf_spec.index()
    page = VocabReport(foaf_spec, basedir='./examples/', temploc='template.html')
 
    simple = page.report()
    print "Simple report: ", simple
    self.assertNotEqual(simple, "Nope!")
Exemplo n.º 6
0
 def testGenerateReport(self):
   """Use the template to generate our report page."""
   foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR,f=FOAFSNAPSHOT, uri = FOAF)
   foaf_spec.index()
   page = VocabReport(foaf_spec, basedir='./examples/', temploc='template.html')
   tpl = page.template
   final = page.generate()
   rdfa = page.rdfa()
   self.assertNotEqual(final, "Nope!")
Exemplo n.º 7
0
    def testSimpleReport(self):
        """Use the template to generate a simple test report in txt."""
        foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR, f=FOAFSNAPSHOT, uri=FOAF)
        foaf_spec.index()
        page = VocabReport(foaf_spec,
                           basedir='./examples/',
                           temploc='template.html')

        simple = page.report()
        print("Simple report: ", simple)
        self.assertNotEqual(simple, "Nope!")
Exemplo n.º 8
0
 def testGenerateReport(self):
     """Use the template to generate our report page."""
     foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR, f=FOAFSNAPSHOT, uri=FOAF)
     foaf_spec.index()
     page = VocabReport(foaf_spec,
                        basedir='./examples/',
                        temploc='template.html')
     tpl = page.template
     final = page.generate()
     rdfa = page.rdfa()
     self.assertNotEqual(final, "Nope!")
Exemplo n.º 9
0
def makeSpec(indir, uri, shortName,outdir,outfile, template, templatedir,indexrdfdir, ontofile):
  spec = Vocab( indexrdfdir, ontofile, uri)
  spec.addShortName(shortName)
  spec.index() # slurp info from sources

  out = VocabReport( spec, indir, template, templatedir ) 

  filename = os.path.join(outdir, outfile)
  print "Printing to ",filename

  f = open(filename,"w")
  result = out.generate()
  f.write(result)
Exemplo n.º 10
0
def makeSpec(indir, uri, shortName, outdir, outfile, template, templatedir,
             indexrdfdir, ontofile):
    spec = Vocab(indexrdfdir, ontofile, uri)
    spec.addShortName(shortName)
    spec.index()  # slurp info from sources

    out = VocabReport(spec, indir, template, templatedir)

    filename = os.path.join(outdir, outfile)
    print "Printing to ", filename

    f = open(filename, "w")
    result = out.generate()
    f.write(result)
Exemplo n.º 11
0
 def testTemplateLoader3(self):
     """Check loaded template isn't default string."""
     foaf_spec = Vocab(FOAFSNAPSHOTDIR, FOAFSNAPSHOT, uri=FOAF)
     foaf_spec.index()
     page = VocabReport(foaf_spec,
                        basedir='./examples/',
                        temploc='template.html')
     tpl = page.template
     self.assertNotEqual(tpl, "no template loaded")
Exemplo n.º 12
0
 def testTemplateLoader2(self):
     """Check we can load a template file thru constructors."""
     foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR, f=FOAFSNAPSHOT, uri=FOAF)
     foaf_spec.index()
     page = VocabReport(foaf_spec,
                        basedir='./examples/',
                        temploc='template.html')
     tpl = page.template
     # print "Page template is: ", tpl
     self.failUnless(tpl != None)
Exemplo n.º 13
0
def makeSpec(indir, uri, shortName,outdir,outfile, template, templatedir, indexrdfdir, ontofile,specurl,name,addGroups):
  spec = Vocab( indexrdfdir, ontofile, uri)
  spec.addShortName(shortName)
  spec.index() # slurp info from sources

  #create a Report
  out = VocabReport( spec, indir, template, templatedir,specurl,name) 
  #check template
  htmlgroups = None
  if (addGroups):
      if out.check_template_for_parameter('%groups%'):
          groups = Grouping(spec,uri)
          htmlgroups = groups.getHTMLGroups();
      else:
          print "Template doesn't contain %groups% parameter -- skipping groups creation"


  filename = os.path.join(outdir, outfile)
  print "Printing to ",filename

  f = open(filename,"w")
  result = out.generate(htmlgroups)
  f.write(result)
Exemplo n.º 14
0
def makeSpec(indir, uri, shortName, outdir, outfile, template, templatedir,
             indexrdfdir, ontofile, specurl, name, addGroups):
    spec = Vocab(indexrdfdir, ontofile, uri)
    spec.addShortName(shortName)
    spec.index()  # slurp info from sources

    #create a Report
    out = VocabReport(spec, indir, template, templatedir, specurl, name)
    #check template
    htmlgroups = None
    if (addGroups):
        if out.check_template_for_parameter('%groups%'):
            groups = Grouping(spec, uri)
            htmlgroups = groups.getHTMLGroups()
        else:
            print "Template doesn't contain %groups% parameter -- skipping groups creation"

    filename = os.path.join(outdir, outfile)
    print "Printing to ", filename

    f = open(filename, "w")
    result = out.generate(htmlgroups)
    f.write(result)