##// END OF EJS Templates
More work addressing review comments for Fernando's branch....
More work addressing review comments for Fernando's branch. * :mod:`IPython.testing.globalipapp` now directly creates a :class:`~IPython.core.iplib.InteractiveShell` instance by passing it a configuration object, rather than creating an IPython application. * Updated everything in :mod:`IPython.frontend` and :mod:`IPython.gui` to use raw :class:`~IPython.core.iplib.InteractiveShell directly rather than creating an IPython application. * Updated the IPython sphinx extension to use raw :class:`~IPython.core.iplib.InteractiveShell directly rather than creating an IPython application. * Removed code from :mod:`IPython.extensions.pretty` that called :func:`get_ipython` (r1271). * Addressed comment on (r1284) about holding refs to deferreds in :mod:`IPython.kernel.ipclusterapp`. * Removed :mod:`IPython.kernel` from list of modules tested by nose in :mod:`IPython.testing.iptest`. (r1318)

File last commit:

r1033:fea50de7
r2499:58bf4021
Show More
test_ipapi.py
54 lines | 978 B | text/x-python | PythonLexer
import sys
sys.path.append('..')
import IPython.ipapi
IPython.ipapi.make_session()
ip = IPython.ipapi.get()
def test_runlines():
import textwrap
ip.runlines(['a = 10', 'a+=1'])
ip.runlines('assert a == 11\nassert 1')
assert ip.user_ns['a'] == 11
complex = textwrap.dedent("""\
if 1:
print "hello"
if 1:
print "world"
if 1:
print "foo"
if 1:
print "bar"
if 1:
print "bar"
""")
ip.runlines(complex)
def test_db():
ip.db['__unittest_'] = 12
assert ip.db['__unittest_'] == 12
del ip.db['__unittest_']
assert '__unittest_' not in ip.db
def test_defalias():
slot = [None]
# test callable alias
def cb(localip,s):
assert localip is ip
slot[0] = s
ip.defalias('testalias', cb)
ip.runlines('testalias foo bar')
assert slot[0] == 'testalias foo bar'
test_runlines()
test_db()
test_defalias