diff --git a/tools/unicode_tests.py b/tools/unicode_tests.py new file mode 100644 index 0000000..d308f05 --- /dev/null +++ b/tools/unicode_tests.py @@ -0,0 +1,18 @@ +# coding: utf-8 +"""These tests have to be run separately from the main test suite (iptest), +because that sets the default encoding to utf-8, and it cannot be changed after +the interpreter is up and running. The default encoding in a Python 2.x +environment is ASCII.""" +import unittest, sys + +from IPython.core import compilerop + +assert sys.getdefaultencoding() == "ascii" + +class CompileropTest(unittest.TestCase): + def test_accept_unicode(self): + cp = compilerop.CachingCompiler() + cp(u"t = 'žćčšđ'", "single") + +if __name__ == "__main__": + unittest.main()