##// END OF EJS Templates
a nicer error message when using %pylab magic...
a nicer error message when using %pylab magic If the user specified an unsupported backend, there was no indication for what the valid names were. Error message prior to this commit: In[1]: %pylab xxx ERROR: Backend u'xxx' not supported. after this commit: In[1]: %pylab xxx ERROR: Backend 'xxx' not supported. Supported backends are: gtk inline osx qt qt4 tk wx

File last commit:

r11146:89e27bce
r11295:cb27e730
Show More
test_storemagic.py
32 lines | 794 B | text/x-python | PythonLexer
import tempfile, os
import nose.tools as nt
ip = get_ipython()
ip.magic('load_ext storemagic')
def test_store_restore():
ip.user_ns['foo'] = 78
ip.magic('alias bar echo "hello"')
tmpd = tempfile.mkdtemp()
ip.magic('cd ' + tmpd)
ip.magic('store foo')
ip.magic('store bar')
# Check storing
nt.assert_equal(ip.db['autorestore/foo'], 78)
nt.assert_in('bar', ip.db['stored_aliases'])
# Remove those items
ip.user_ns.pop('foo', None)
ip.alias_manager.undefine_alias('bar')
ip.magic('cd -')
ip.user_ns['_dh'][:] = []
# Check restoring
ip.magic('store -r')
nt.assert_equal(ip.user_ns['foo'], 78)
nt.assert_in('bar', ip.alias_manager.alias_table)
nt.assert_in(tmpd, ip.user_ns['_dh'])
os.rmdir(tmpd)