##// END OF EJS Templates
Add test for non-ascii tracebacks.
Thomas Kluyver -
Show More
@@ -1,6 +1,7 b''
1 # encoding: utf-8
1 """Tests for IPython.core.ultratb
2 """Tests for IPython.core.ultratb
2 """
3 """
3
4 import io
4 import os.path
5 import os.path
5 import unittest
6 import unittest
6
7
@@ -49,3 +50,26 b' class ChangedPyFileTest(unittest.TestCase):'
49 ip.run_cell("foo.f()")
50 ip.run_cell("foo.f()")
50 with tt.AssertPrints("ZeroDivisionError"):
51 with tt.AssertPrints("ZeroDivisionError"):
51 ip.run_cell("foo.f()")
52 ip.run_cell("foo.f()")
53
54 iso_8859_5_file = u'''# coding: iso-8859-5
55
56 def fail():
57 """дбИЖ"""
58 1/0 # дбИЖ
59 '''
60
61 class NonAsciiTest(unittest.TestCase):
62 def test_iso8859_5(self):
63 # Non-ascii directory name as well.
64 with TemporaryDirectory(suffix=u'é') as td:
65 fname = os.path.join(td, 'dfghjkl.py')
66
67 with io.open(fname, 'w', encoding='iso-8859-5') as f:
68 f.write(iso_8859_5_file)
69
70 with prepended_to_syspath(td):
71 ip.run_cell("from dfghjkl import fail")
72
73 with tt.AssertPrints("ZeroDivisionError"):
74 with tt.AssertPrints(u'дбИЖ', suppress=False):
75 ip.run_cell('fail()')
General Comments 0
You need to be logged in to leave comments. Login now