def __init__(self, data): self.r = redis.Redis(port=int(REDIS_PORT)) self.sr = ScoreRank(self.r, 'a', 'b', 'c') self.all_userids = [] for userid, score in data: self.all_userids.append(userid) self.sr.set(userid, score) print "start"
def setUp(self): self.r = redis.Redis(port=int(REDIS_PORT)) self.sr = ScoreRank(self.r, 'a', 'b', 'c') data = [ (1, 10), (2, 10), (3, 8), (4, 6), (5, 8), (6, 14), (7, 14), (8, 16) ] for user_id, add_score in data: self.sr.set(user_id, add_score)