Format: application/x-python-code
⬇ Download File (2.4 KB)
   1  o
   2  
   3  ��hs�@s0dZdd�Zdd�Zdd�Zdd�Zd	d
   4  �ZdS)apTests 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  cC�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�rrr�[c:\Users\shubh\Videos\agent\nova\Lib\site-packages\IPython/testing/plugin/test_ipdoctest.py�doctest_simple
  19  �rcCr)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      Nrrrrr�doctest_multiline1rrcCr)a0Multiline 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      Nrrrrr�doctest_multiline2 rrcCr)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     Nrrrrr�doctest_multiline36rrcCr)aDefining 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      Nrrrrr�doctest_builtin_underscoreOrr	N)�__doc__rrrrr	rrrr�<module>s	
  80