diff --git a/IPython/core/tests/test_iplib.py b/IPython/core/tests/test_iplib.py index 2fa6633..8b4276c 100644 --- a/IPython/core/tests/test_iplib.py +++ b/IPython/core/tests/test_iplib.py @@ -243,3 +243,37 @@ SystemExit Traceback (most recent call last) SystemExit: (2, 'Mode = exit') """ + + +def test_runlines(): + import textwrap + ip.runlines(['a = 10', 'a+=1']) + ip.runlines('assert a == 11\nassert 1') + + nt.assert_equals(ip.user_ns['a'], 11) + complex = textwrap.dedent(""" + if 1: + print "hello" + if 1: + print "world" + + if 2: + print "foo" + + if 3: + print "bar" + + if 4: + print "bar" + + """) + # Simply verifies that this kind of input is run + ip.runlines(complex) + + +def test_db(): + """Test the internal database used for variable persistence.""" + ip.db['__unittest_'] = 12 + nt.assert_equals(ip.db['__unittest_'], 12) + del ip.db['__unittest_'] + assert '__unittest_' not in ip.db diff --git a/test/manualtest_repr_tb.py b/test/manualtest_repr_tb.py deleted file mode 100644 index 93dff69..0000000 --- a/test/manualtest_repr_tb.py +++ /dev/null @@ -1,16 +0,0 @@ -"""This should be run directly from ipython, and it should NOT crash. - -It can't currently be run via runtests b/c exception handling changes there, -and this is precisely testing exception handling problems.""" - -ipmagic('xmode verbose') - -src = """ -class suck(object): - def __repr__(self): - raise ValueError("who needs repr anyway") - -suck() -""" - -__IPYTHON__.runlines(src) diff --git a/test/test_ihist.ipy b/test/test_ihist.ipy deleted file mode 100644 index 6f9bce6..0000000 --- a/test/test_ihist.ipy +++ /dev/null @@ -1,2 +0,0 @@ -1+2 -assert _ == 3 diff --git a/test/test_ipapi.py b/test/test_ipapi.py deleted file mode 100644 index 30f51f4..0000000 --- a/test/test_ipapi.py +++ /dev/null @@ -1,54 +0,0 @@ -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 diff --git a/test/test_shouldfail.ipy b/test/test_shouldfail.ipy deleted file mode 100644 index 128f229..0000000 --- a/test/test_shouldfail.ipy +++ /dev/null @@ -1,3 +0,0 @@ -# this will fail w/ assertionerror -cd / -assert os.getcwd() == '/does/not/exist'