Ejemplo n.º 1
0
    def test_broader_support_sanity(self):
        self.assert_(
            online.calculate_broad_support(self.ids["violence"], self.s)
            > online.calculate_broad_support(self.ids["pants"], self.s)
        )

        self.assert_(
            online.calculate_broad_support(self.ids["nonviolence"], self.s)
            > online.calculate_broad_support(self.ids["pants"], self.s)
        )
Ejemplo n.º 2
0
 def vote(self, uid, pid):
   if len(self.db.select('vote', where='uid=%d and pid=%d'%(uid, pid))) == 0:
     self.db.query('INSERT INTO vote (uid, pid) VALUES (%d, %d)' %
                   (uid, pid))
     self._update_support(pid, online.calculate_broad_support(pid, self))