Format: application/x-python-code
1 o
2
3 ��hs � @ s0 d Z dd� Zdd� Zdd� Zdd� Zd d
4 � ZdS )ap Tests for the ipdoctest machinery itself.
5
6 Note: in a file named test_X, functions whose only test is their docstring (as
7 a doctest) and which have no test functionality of their own, should be called
8 'doctest_foo' instead of 'test_foo', otherwise they get double-counted (the
9 empty function call is counted as a test, which just inflates tests numbers
10 artificially).
11 c C � dS )zeipdoctest must handle simple inputs
12
13 In [1]: 1
14 Out[1]: 1
15
16 In [2]: print(1)
17 1
18 N� r r r �[c:\Users\shubh\Videos\agent\nova\Lib\site-packages\IPython/testing/plugin/test_ipdoctest.py�doctest_simple
19 � r c C r )z�The ipdoctest machinery must handle multiline examples gracefully.
20
21 In [2]: for i in range(4):
22 ...: print(i)
23 ...:
24 0
25 1
26 2
27 3
28 Nr r r r r �doctest_multiline1 r r c C r )a0 Multiline examples that define functions and print output.
29
30 In [7]: def f(x):
31 ...: return x+1
32 ...:
33
34 In [8]: f(1)
35 Out[8]: 2
36
37 In [9]: def g(x):
38 ...: print('x is:',x)
39 ...:
40
41 In [10]: g(1)
42 x is: 1
43
44 In [11]: g('hello')
45 x is: hello
46 Nr r r r r �doctest_multiline2 r r c C r )a� Multiline examples with blank lines.
47
48 In [12]: def h(x):
49 ....: if x>1:
50 ....: return x**2
51 ....: # To leave a blank line in the input, you must mark it
52 ....: # with a comment character:
53 ....: #
54 ....: # otherwise the doctest parser gets confused.
55 ....: else:
56 ....: return -1
57 ....:
58
59 In [13]: h(5)
60 Out[13]: 25
61
62 In [14]: h(1)
63 Out[14]: -1
64
65 In [15]: h(0)
66 Out[15]: -1
67 Nr r r r r �doctest_multiline36 r r c C r )a Defining builtins._ should not break anything outside the doctest
68 while also should be working as expected inside the doctest.
69
70 In [1]: import builtins
71
72 In [2]: builtins._ = 42
73
74 In [3]: builtins._
75 Out[3]: 42
76
77 In [4]: _
78 Out[4]: 42
79 Nr r r r r �doctest_builtin_underscoreO r r N)�__doc__r r r r r r r r r �<module> s
80