Test coverage for vnccollab.theme.indexers

vnccollab/      covered 69% (1245 of 4098 uncovered)
    theme/      covered 69% (1245 of 4098 uncovered)
        indexers.py      covered 100% (0 of 14 uncovered)

    1: from plone.indexer.decorator import indexer
    1: from zope.annotation.interfaces import IAnnotations
       
    1: from cioppino.twothumbs.interfaces import ILoveThumbsDontYou
    1: from cioppino.twothumbs.rate import yays, nays, getTotalPositiveRatings
       
       
    1: @indexer(ILoveThumbsDontYou)
       def avg_ratings(object, **kw):
           """Average rating: difference between thumb ups and downs.
           """
  167:     annotations = IAnnotations(object)
  167:     ups = (yays in annotations) and len(annotations[yays]) or 0
  167:     downs = (nays in annotations) and len(annotations[nays]) or 0
  167:     return ups - downs
       
    1: @indexer(ILoveThumbsDontYou)
       def total_down_ratings(object, **kw):
           """
           Return the total number of negative ratings
           """
  167:     annotations = IAnnotations(object)
  167:     if nays in annotations:
    3:         return len(annotations[nays])
       
  164:     return 0