Show More
@@ -1,3 +1,4 b'' | |||
|
1 | # coding: utf-8 | |
|
1 | 2 | """Tests for IPython.lib.pretty.""" |
|
2 | 3 | |
|
3 | 4 | # Copyright (c) IPython Development Team. |
@@ -5,13 +6,11 b'' | |||
|
5 | 6 | |
|
6 | 7 | from __future__ import print_function |
|
7 | 8 | |
|
8 | # Third-party imports | |
|
9 | 9 | import nose.tools as nt |
|
10 | 10 | |
|
11 | # Our own imports | |
|
12 | 11 | from IPython.lib import pretty |
|
13 | 12 | from IPython.testing.decorators import skip_without |
|
14 | from IPython.utils.py3compat import PY3 | |
|
13 | from IPython.utils.py3compat import PY3, unicode_to_str | |
|
15 | 14 | |
|
16 | 15 | if PY3: |
|
17 | 16 | from io import StringIO |
@@ -238,6 +237,21 b' def test_metaclass_repr():' | |||
|
238 | 237 | nt.assert_equal(output, "[CUSTOM REPR FOR CLASS ClassWithMeta]") |
|
239 | 238 | |
|
240 | 239 | |
|
240 | def test_unicode_repr(): | |
|
241 | u = u"üniço∂é" | |
|
242 | ustr = unicode_to_str(u) | |
|
243 | ||
|
244 | class C(object): | |
|
245 | def __repr__(self): | |
|
246 | return ustr | |
|
247 | ||
|
248 | c = C() | |
|
249 | p = pretty.pretty(c) | |
|
250 | nt.assert_equal(p, u) | |
|
251 | p = pretty.pretty([c]) | |
|
252 | nt.assert_equal(p, u'[%s]' % u) | |
|
253 | ||
|
254 | ||
|
241 | 255 | def test_basic_class(): |
|
242 | 256 | def type_pprint_wrapper(obj, p, cycle): |
|
243 | 257 | if obj is MyObj: |
General Comments 0
You need to be logged in to leave comments.
Login now