Ejemplo n.º 1
0
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'))
Ejemplo n.º 2
0
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'))
Ejemplo n.º 3
0
def output(testname):
    return recall(tname(testname)+'.out')
Ejemplo n.º 4
0
def like(testname):
    text = recall(tname(testname)+'.out')
    save(tname(testname)+'.correct', text)
Ejemplo n.º 5
0
def get_code(testname):
    return write_file(tname(testname)+'.tst', recall(tname(testname)+'.tst'))
Ejemplo n.º 6
0
def page_html(url):
    return recall(url+'.html')
def accept(collection):
    t = recall(collection + '/current')
    save(collection + '/past', t)
Ejemplo n.º 8
0
def like(url):
    text = recall(url+'.txt')
    save(url+'.correct', text)
Ejemplo n.º 9
0
def redis_missing_test():
    assert (recall('test_redis/missing') == None)
    assert (recall('test_redis/name') != None)
Ejemplo n.º 10
0
def like(url):
    text = recall(url + '.txt')
    save(url + '.correct', text)
Ejemplo n.º 11
0
def get_code(testname):
    return write_file(
        tname(testname) + '.tst', recall(tname(testname) + '.tst'))
Ejemplo n.º 12
0
def page_html(url):
    return recall(url + '.html')
Ejemplo n.º 13
0
def page_correct(url):
    correct_text = recall(url + '.correct')
    if correct_text:
        write_file(join(environ['pt'], gethostname(), url), [correct_text])
    return correct_text
Ejemplo n.º 14
0
def page_text(url):
    return recall(url + '.txt')
Ejemplo n.º 15
0
def accept(collection):
    t = recall(collection+'/current')
    save(collection+'/past',t)
Ejemplo n.º 16
0
def changes(collection):
    t1 = recall(collection+'/past')
    t2 = recall(collection+'/current')
    return dict_diff(t2,t1)
Ejemplo n.º 17
0
def correct(testname):
    correct_text = recall(tname(testname)+'.correct')
    if correct_text:
        write_file(join(environ['pt'],gethostname(),testname), [correct_text])
    return correct_text
Ejemplo n.º 18
0
def correct(testname):
    correct_text = recall(tname(testname) + '.correct')
    if correct_text:
        write_file(join(environ['pt'], gethostname(), testname),
                   [correct_text])
    return correct_text
Ejemplo n.º 19
0
def like(testname):
    text = recall(tname(testname) + '.out')
    save(tname(testname) + '.correct', text)
Ejemplo n.º 20
0
def page_correct(url):
    correct_text = recall(url+'.correct')
    if correct_text:
        write_file(join(environ['pt'],gethostname(),url), [correct_text])
    return correct_text
Ejemplo n.º 21
0
def output(testname):
    return recall(tname(testname) + '.out')
Ejemplo n.º 22
0
def redis_missing_test():
    assert(recall('test_redis/missing')==None)
    assert(recall('test_redis/name')!=None)
Ejemplo n.º 23
0
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)
Ejemplo n.º 25
0
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')
Ejemplo n.º 26
0
def page_text(url):
    return recall(url+'.txt')