method = bra code = "y = brain['x']" for n in (1, 2, 3): start = time.time() y = brain['x'] show(start, task, method, code, n) track.loc[i] = [ task, method, round((time.time() - start) * 1000, 4), n, code ] i += 1 print(s, '\nSaving small objects - a single string "this is the test string"', s) brain.forget('x') os.remove('test.pkl') task = 'save small' method = mem code = 'x = "this is the test string"' for n in [1, 2, 3]: start = time.time() x = "this is the test string" show(start, task, method, code, n) track.loc[i] = [ task, method, round((time.time() - start) * 1000, 4), n, code ] i += 1
brain.learn('a',l) brain.learn('b',m) brain.learn('c',n) brain.learn('d',o) assert list(l.columns)==list(brain.recall('a').columns) assert set([x for x in l.that])==set([x for x in brain.recall('a').that]) assert list(m.this[:5].values)==list(brain.recall('b').this[:5].values) assert n.values[0]==brain.recall('c').values[0] assert o.values[0]==brain.recall('d').values[0] # changing name values did not change number of names present in plasma assert len(brain.names())==17 # delete python objects, and confirm that they no longer exist in plasma store for name in 'abcdefghijklmnopq': brain.forget(name) x = 0 try: brain.recall(name) x = 5 except: pass if x==5: raise BaseException # sleep the brain brain.sleep() # reconnect the brain brain.wake_up()