##// END OF EJS Templates
Various fixes for tests in IPython.testing.
Thomas Kluyver -
Show More
@@ -3,6 +3,7 b''
3 3 This file just contains doctests both using plain python and IPython prompts.
4 4 All tests should be loaded by nose.
5 5 """
6 from IPython.utils.py3compat import doctest_refactor_print
6 7
7 8 def pyfunc():
8 9 """Some pure python tests...
@@ -23,7 +24,7 b' def pyfunc():'
23 24 """
24 25 return 'pyfunc'
25 26
26
27 @doctest_refactor_print
27 28 def ipfunc():
28 29 """Some ipython tests...
29 30
@@ -127,7 +128,7 b' def random_all():'
127 128 """
128 129 pass
129 130
130
131 @doctest_refactor_print
131 132 def iprand():
132 133 """Some ipython tests with random output.
133 134
@@ -142,7 +143,7 b' def iprand():'
142 143 """
143 144 return 'iprand'
144 145
145
146 @doctest_refactor_print
146 147 def iprand_all():
147 148 """Some ipython tests with fully random output.
148 149
@@ -160,3 +161,4 b' def iprand_all():'
160 161 return 'iprand_all'
161 162
162 163
164
@@ -6,7 +6,9 b' a doctest) and which have no test functionality of their own, should be called'
6 6 empty function call is counted as a test, which just inflates tests numbers
7 7 artificially).
8 8 """
9 from IPython.utils.py3compat import doctest_refactor_print
9 10
11 @doctest_refactor_print
10 12 def doctest_simple():
11 13 """ipdoctest must handle simple inputs
12 14
@@ -17,17 +19,20 b' def doctest_simple():'
17 19 1
18 20 """
19 21
20
22 @doctest_refactor_print
21 23 def doctest_multiline1():
22 24 """The ipdoctest machinery must handle multiline examples gracefully.
23 25
24 In [2]: for i in range(10):
25 ...: print i,
26 In [2]: for i in range(4):
27 ...: print i
26 28 ...:
27 0 1 2 3 4 5 6 7 8 9
29 0
30 1
31 2
32 3
28 33 """
29 34
30
35 @doctest_refactor_print
31 36 def doctest_multiline2():
32 37 """Multiline examples that define functions and print output.
33 38
@@ -42,5 +42,5 b' def doctest_refs():'
42 42 """DocTest reference holding issues when running scripts.
43 43
44 44 In [32]: run show_refs.py
45 c referrers: [<type 'dict'>]
45 c referrers: [<... 'dict'>]
46 46 """
@@ -46,11 +46,13 b' Authors'
46 46 #-----------------------------------------------------------------------------
47 47
48 48 from IPython.testing.ipunittest import ipdoctest, ipdocstring
49 from IPython.utils.py3compat import doctest_refactor_print
49 50
50 51 #-----------------------------------------------------------------------------
51 52 # Test classes and functions
52 53 #-----------------------------------------------------------------------------
53 54 @ipdoctest
55 @doctest_refactor_print
54 56 def simple_dt():
55 57 """
56 58 >>> print 1+1
@@ -59,16 +61,20 b' def simple_dt():'
59 61
60 62
61 63 @ipdoctest
64 @doctest_refactor_print
62 65 def ipdt_flush():
63 66 """
64 67 In [20]: print 1
65 68 1
66 69
67 In [26]: for i in range(10):
68 ....: print i,
70 In [26]: for i in range(4):
71 ....: print i
69 72 ....:
70 73 ....:
71 0 1 2 3 4 5 6 7 8 9
74 0
75 1
76 2
77 3
72 78
73 79 In [27]: 3+4
74 80 Out[27]: 7
@@ -76,16 +82,20 b' Out[27]: 7'
76 82
77 83
78 84 @ipdoctest
85 @doctest_refactor_print
79 86 def ipdt_indented_test():
80 87 """
81 88 In [20]: print 1
82 89 1
83 90
84 In [26]: for i in range(10):
85 ....: print i,
91 In [26]: for i in range(4):
92 ....: print i
86 93 ....:
87 94 ....:
88 0 1 2 3 4 5 6 7 8 9
95 0
96 1
97 2
98 3
89 99
90 100 In [27]: 3+4
91 101 Out[27]: 7
@@ -100,21 +110,26 b' class Foo(object):'
100 110 """
101 111
102 112 @ipdocstring
113 @doctest_refactor_print
103 114 def ipdt_method(self):
104 115 """
105 116 In [20]: print 1
106 117 1
107 118
108 In [26]: for i in range(10):
109 ....: print i,
119 In [26]: for i in range(4):
120 ....: print i
110 121 ....:
111 122 ....:
112 0 1 2 3 4 5 6 7 8 9
123 0
124 1
125 2
126 3
113 127
114 128 In [27]: 3+4
115 129 Out[27]: 7
116 130 """
117 131
132 @doctest_refactor_print
118 133 def normaldt_method(self):
119 134 """
120 135 >>> print 1+1
General Comments 0
You need to be logged in to leave comments. Login now