##// END OF EJS Templates
Merge pull request #3506 from takluyver/storemagic_restore_aliases...
Min RK -
r11147:b11b916e merge
parent child Browse files
Show More
@@ -0,0 +1,32 b''
1 import tempfile, os
2
3 import nose.tools as nt
4
5 ip = get_ipython()
6 ip.magic('load_ext storemagic')
7
8 def test_store_restore():
9 ip.user_ns['foo'] = 78
10 ip.magic('alias bar echo "hello"')
11 tmpd = tempfile.mkdtemp()
12 ip.magic('cd ' + tmpd)
13 ip.magic('store foo')
14 ip.magic('store bar')
15
16 # Check storing
17 nt.assert_equal(ip.db['autorestore/foo'], 78)
18 nt.assert_in('bar', ip.db['stored_aliases'])
19
20 # Remove those items
21 ip.user_ns.pop('foo', None)
22 ip.alias_manager.undefine_alias('bar')
23 ip.magic('cd -')
24 ip.user_ns['_dh'][:] = []
25
26 # Check restoring
27 ip.magic('store -r')
28 nt.assert_equal(ip.user_ns['foo'], 78)
29 nt.assert_in('bar', ip.alias_manager.alias_table)
30 nt.assert_in(tmpd, ip.user_ns['_dh'])
31
32 os.rmdir(tmpd)
@@ -144,7 +144,7 b' class StoreMagics(Magics):'
144 else:
144 else:
145 ip.user_ns[arg] = obj
145 ip.user_ns[arg] = obj
146 else:
146 else:
147 refresh_variables(ip)
147 restore_data(ip)
148
148
149 # run without arguments -> list variables & values
149 # run without arguments -> list variables & values
150 elif not args:
150 elif not args:
General Comments 0
You need to be logged in to leave comments. Login now