def test2(self): ensemble = BitEnsemble([1, 11, 21, 31]) bv = SparseBitVect(100) bv.SetBit(1) bv.SetBit(11) bv.SetBit(13) score = ensemble.ScoreWithOnBits(bv) assert score == 2, 'bad score: %d' % (score) score = ensemble.ScoreWithIndex(bv) assert score == 2, 'bad score: %d' % (score)
def test1(self): ensemble = BitEnsemble() ensemble.SetBits([1, 11, 21, 31]) self.assertEqual(ensemble.GetNumBits(), 4) bv = SparseBitVect(100) bv.SetBit(1) bv.SetBit(11) bv.SetBit(13) score = ensemble.ScoreWithOnBits(bv) assert score == 2, 'bad score: %d' % (score) score = ensemble.ScoreWithIndex(bv) assert score == 2, 'bad score: %d' % (score)