Ejemplo n.º 1
0
def run(prnt, iterations):
    print
    print "Performance of django tags versus classytags. %s iterations." % iterations
    print
    pool.autodiscover()
    table = []
    table.append(["Tagname", "Django", "Classytags", "Ratio"])
    for tagname, data in pool:
        bench = Benchmark(data['tag']) 
        django = bench.django(iterations)
        classy = bench.classy(iterations)
        ratio = classy / django
        if tagname.startswith('ct_'):
            tagname = tagname[3:]
        table.append([tagname, django, classy, ratio])
    if prnt:
        pprint_table(sys.stdout, table)
    else:
        return table
Ejemplo n.º 2
0
 def test_10_django_vs_classy(self):
     pool.autodiscover()
     for tagname, data in pool:
         controls = data.get('controls', None)
         if not controls: # pragma: no cover
             continue
         tag = data['tag']                
         renderer = Renderer(tag)
         i = 0
         for djstring, ctstring, ctx in controls:
             i += 1
             dj = renderer.django(djstring, ctx)
             cy = renderer.classy(ctstring, ctx)
             self.assertNotEqual(djstring, ctstring)
             self.assertEqual(dj, cy,
                 ("Classytag implementation of %s (control %s) returned "
                  "something else than official tag:\n"
                  "Classy: %r\nDjango: %r" % (tagname, i, cy, dj))
             )