def redis_expiration_test(): save ('test_redis/expiration','Yeah') save ('test_redis/expiration1','Yeah') expire('test_redis/expiration1',1) expire('test_redis/expiration',10) assert(expiration('test_redis/expiration')==10) assert(expiration('test_redis/expiration1')==1) assert(recall('test_redis/expiration1')=='Yeah') sleep(1) assert(expiration('test_redis/expiration')==9) assert(not recall('test_redis/expiration1'))
def redis_expiration_test(): save('test_redis/expiration', 'Yeah') save('test_redis/expiration1', 'Yeah') expire('test_redis/expiration1', 1) expire('test_redis/expiration', 10) assert (expiration('test_redis/expiration') == 10) assert (expiration('test_redis/expiration1') == 1) assert (recall('test_redis/expiration1') == 'Yeah') sleep(1) assert (expiration('test_redis/expiration') == 9) assert (not recall('test_redis/expiration1'))
def output(testname): return recall(tname(testname)+'.out')
def like(testname): text = recall(tname(testname)+'.out') save(tname(testname)+'.correct', text)
def get_code(testname): return write_file(tname(testname)+'.tst', recall(tname(testname)+'.tst'))
def page_html(url): return recall(url+'.html')
def accept(collection): t = recall(collection + '/current') save(collection + '/past', t)
def like(url): text = recall(url+'.txt') save(url+'.correct', text)
def redis_missing_test(): assert (recall('test_redis/missing') == None) assert (recall('test_redis/name') != None)
def like(url): text = recall(url + '.txt') save(url + '.correct', text)
def get_code(testname): return write_file( tname(testname) + '.tst', recall(tname(testname) + '.tst'))
def page_html(url): return recall(url + '.html')
def page_correct(url): correct_text = recall(url + '.correct') if correct_text: write_file(join(environ['pt'], gethostname(), url), [correct_text]) return correct_text
def page_text(url): return recall(url + '.txt')
def accept(collection): t = recall(collection+'/current') save(collection+'/past',t)
def changes(collection): t1 = recall(collection+'/past') t2 = recall(collection+'/current') return dict_diff(t2,t1)
def correct(testname): correct_text = recall(tname(testname)+'.correct') if correct_text: write_file(join(environ['pt'],gethostname(),testname), [correct_text]) return correct_text
def correct(testname): correct_text = recall(tname(testname) + '.correct') if correct_text: write_file(join(environ['pt'], gethostname(), testname), [correct_text]) return correct_text
def like(testname): text = recall(tname(testname) + '.out') save(tname(testname) + '.correct', text)
def page_correct(url): correct_text = recall(url+'.correct') if correct_text: write_file(join(environ['pt'],gethostname(),url), [correct_text]) return correct_text
def output(testname): return recall(tname(testname) + '.out')
def redis_missing_test(): assert(recall('test_redis/missing')==None) assert(recall('test_redis/name')!=None)
def redis_test(): #assert(recall('test_redis/name')=='Eric') assert(save ('test_redis/name','Mark')==None) assert(recall('test_redis/name')=='Mark') assert(save ('test_redis/name','Eric')==None) assert(recall('test_redis/name')=='Eric')
def changes(collection): t1 = recall(collection + '/past') t2 = recall(collection + '/current') return dict_diff(t2, t1)
def redis_test(): #assert(recall('test_redis/name')=='Eric') assert (save('test_redis/name', 'Mark') == None) assert (recall('test_redis/name') == 'Mark') assert (save('test_redis/name', 'Eric') == None) assert (recall('test_redis/name') == 'Eric')
def page_text(url): return recall(url+'.txt')