File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33This file just contains doctests both using plain python and IPython prompts.
44All tests should be loaded by nose.
55"""
6+ from IPython .utils .py3compat import doctest_refactor_print
67
78def pyfunc ():
89 """Some pure python tests...
@@ -23,7 +24,7 @@ def pyfunc():
2324 """
2425 return 'pyfunc'
2526
26-
27+ @ doctest_refactor_print
2728def ipfunc ():
2829 """Some ipython tests...
2930
@@ -127,7 +128,7 @@ def random_all():
127128 """
128129 pass
129130
130-
131+ @ doctest_refactor_print
131132def iprand ():
132133 """Some ipython tests with random output.
133134
@@ -142,7 +143,7 @@ def iprand():
142143 """
143144 return 'iprand'
144145
145-
146+ @ doctest_refactor_print
146147def iprand_all ():
147148 """Some ipython tests with fully random output.
148149
@@ -160,3 +161,4 @@ def iprand_all():
160161 return 'iprand_all'
161162
162163
164+
Original file line number Diff line number Diff line change 66empty function call is counted as a test, which just inflates tests numbers
77artificially).
88"""
9+ from IPython .utils .py3compat import doctest_refactor_print
910
11+ @doctest_refactor_print
1012def doctest_simple ():
1113 """ipdoctest must handle simple inputs
1214
@@ -17,17 +19,20 @@ def doctest_simple():
1719 1
1820 """
1921
20-
22+ @ doctest_refactor_print
2123def doctest_multiline1 ():
2224 """The ipdoctest machinery must handle multiline examples gracefully.
2325
24- In [2]: for i in range(10 ):
25- ...: print i,
26+ In [2]: for i in range(4 ):
27+ ...: print i
2628 ...:
27- 0 1 2 3 4 5 6 7 8 9
29+ 0
30+ 1
31+ 2
32+ 3
2833 """
2934
30-
35+ @ doctest_refactor_print
3136def doctest_multiline2 ():
3237 """Multiline examples that define functions and print output.
3338
Original file line number Diff line number Diff line change @@ -42,5 +42,5 @@ def doctest_refs():
4242 """DocTest reference holding issues when running scripts.
4343
4444 In [32]: run show_refs.py
45- c referrers: [<type 'dict'>]
45+ c referrers: [<... 'dict'>]
4646 """
Original file line number Diff line number Diff line change 4646#-----------------------------------------------------------------------------
4747
4848from IPython .testing .ipunittest import ipdoctest , ipdocstring
49+ from IPython .utils .py3compat import doctest_refactor_print
4950
5051#-----------------------------------------------------------------------------
5152# Test classes and functions
5253#-----------------------------------------------------------------------------
5354@ipdoctest
55+ @doctest_refactor_print
5456def simple_dt ():
5557 """
5658 >>> print 1+1
@@ -59,33 +61,41 @@ def simple_dt():
5961
6062
6163@ipdoctest
64+ @doctest_refactor_print
6265def ipdt_flush ():
6366 """
6467In [20]: print 1
65681
6669
67- In [26]: for i in range(10 ):
68- ....: print i,
70+ In [26]: for i in range(4 ):
71+ ....: print i
6972 ....:
7073 ....:
71- 0 1 2 3 4 5 6 7 8 9
74+ 0
75+ 1
76+ 2
77+ 3
7278
7379In [27]: 3+4
7480Out[27]: 7
7581"""
7682
7783
7884@ipdoctest
85+ @doctest_refactor_print
7986def ipdt_indented_test ():
8087 """
8188 In [20]: print 1
8289 1
8390
84- In [26]: for i in range(10 ):
85- ....: print i,
91+ In [26]: for i in range(4 ):
92+ ....: print i
8693 ....:
8794 ....:
88- 0 1 2 3 4 5 6 7 8 9
95+ 0
96+ 1
97+ 2
98+ 3
8999
90100 In [27]: 3+4
91101 Out[27]: 7
@@ -100,21 +110,26 @@ class Foo(object):
100110 """
101111
102112 @ipdocstring
113+ @doctest_refactor_print
103114 def ipdt_method (self ):
104115 """
105116 In [20]: print 1
106117 1
107118
108- In [26]: for i in range(10 ):
109- ....: print i,
119+ In [26]: for i in range(4 ):
120+ ....: print i
110121 ....:
111122 ....:
112- 0 1 2 3 4 5 6 7 8 9
123+ 0
124+ 1
125+ 2
126+ 3
113127
114128 In [27]: 3+4
115129 Out[27]: 7
116130 """
117131
132+ @doctest_refactor_print
118133 def normaldt_method (self ):
119134 """
120135 >>> print 1+1
You can’t perform that action at this time.
0 commit comments