##// END OF EJS Templates
Fixing misc testing related things.
Fixing misc testing related things.

File last commit:

r1960:51f38f50
r1960:51f38f50
Show More
test_interpreter.py
64 lines | 2.3 KiB | text/x-python | PythonLexer
/ IPython / kernel / core / tests / test_interpreter.py
gvaroquaux
Add a test for the error previously discovered.
r1643 # encoding: utf-8
"""This file contains unittests for the interpreter.py module."""
__docformat__ = "restructuredtext en"
#-----------------------------------------------------------------------------
Gael Varoquaux
BUG: Fix wrong command splitting in Interpreter
r1898 # Copyright (C) 2008-2009 The IPython Development Team
gvaroquaux
Add a test for the error previously discovered.
r1643 #
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
Gael Varoquaux
BUG: Fix wrong command splitting in Interpreter
r1898
gvaroquaux
Add a test for the error previously discovered.
r1643 #-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
Brian Granger
Added tests and comments for: https://bugs.launchpad.net/bugs/266993...
r1946 import unittest
gvaroquaux
Add a test for the error previously discovered.
r1643 from IPython.kernel.core.interpreter import Interpreter
Gael Varoquaux
BUG: Fix wrong command splitting in Interpreter
r1898 #-----------------------------------------------------------------------------
# Tests
#-----------------------------------------------------------------------------
gvaroquaux
Add a test for the error previously discovered.
r1643
Brian Granger
Fixing misc testing related things.
r1960 # Tell nose to skip this module
__test__ = {}
Brian Granger
Added tests and comments for: https://bugs.launchpad.net/bugs/266993...
r1946 class TestInterpreter(unittest.TestCase):
Brian Granger
Merged Gael's ipython-sync-frontend branch with important mods....
r1949
Brian Granger
Added tests and comments for: https://bugs.launchpad.net/bugs/266993...
r1946 def test_unicode(self):
Brian Granger
Merged Gael's ipython-sync-frontend branch with important mods....
r1949 """ Test unicode handling with the interpreter."""
Brian Granger
Added tests and comments for: https://bugs.launchpad.net/bugs/266993...
r1946 i = Interpreter()
i.execute_python(u'print "ù"')
i.execute_python('print "ù"')
Brian Granger
Merged Gael's ipython-sync-frontend branch with important mods....
r1949
Brian Granger
Closing invalid ticket 364347....
r1951 def test_ticket266993(self):
Brian Granger
Merged Gael's ipython-sync-frontend branch with important mods....
r1949 """ Test for ticket 266993."""
Brian Granger
Added tests and comments for: https://bugs.launchpad.net/bugs/266993...
r1946 i = Interpreter()
i.execute('str("""a\nb""")')
gvaroquaux
Add a test for the error previously discovered.
r1643
Brian Granger
Merged Gael's ipython-sync-frontend branch with important mods....
r1949 def test_ticket364347(self):
"""Test for ticket 364347."""
Brian Granger
Added tests and comments for: https://bugs.launchpad.net/bugs/266993...
r1946 i = Interpreter()
Brian Granger
Closing invalid ticket 364347....
r1951 i.split_commands('str("a\\nb")')
Brian Granger
Merged Gael's ipython-sync-frontend branch with important mods....
r1949
def test_split_commands(self):
""" Test that commands are indeed individually split."""
i = Interpreter()
test_atoms = [('(1\n + 1)', ),
('1', '1', ),
]
for atoms in test_atoms:
atoms = [atom.rstrip() + '\n' for atom in atoms]
self.assertEquals(i.split_commands(''.join(atoms)),atoms)
def test_long_lines(self):
""" Test for spurious syntax error created by the interpreter."""
test_strings = [u'( 1 +\n 1\n )\n\n',
u'(1 \n + 1\n )\n\n',
]
i = Interpreter()
for s in test_strings:
i.execute(s)
Gael Varoquaux
BUG: Fix wrong command splitting in Interpreter
r1898