##// END OF EJS Templates
BUG: Remove the pretty extension as it is now obsolete.
BUG: Remove the pretty extension as it is now obsolete.

File last commit:

r3209:21a2f043
r3226:d8f4a0ec
Show More
test_formatters.py
30 lines | 593 B | text/x-python | PythonLexer
"""Tests for the Formatters.
"""
import nose.tools as nt
from IPython.core.formatters import FormatterABC, DefaultFormatter
class A(object):
def __repr__(self):
return 'A()'
class B(A):
def __repr__(self):
return 'B()'
def foo_printer(obj, pp, cycle):
pp.text('foo')
def test_pretty():
f = DefaultFormatter()
f.for_type(A, foo_printer)
nt.assert_equals(f(A()), 'foo')
nt.assert_equals(f(B()), 'foo')
f.pprint = False
nt.assert_equals(f(A()), 'A()')
nt.assert_equals(f(B()), 'B()')
def test_deferred():
f = DefaultFormatter()