From 1110808a9d39d4b808aef724c861a2e1a38d2a69 Mon Sep 17 00:00:00 2001
From: Devtools Arcadia <arcadia-devtools@yandex-team.ru>
Date: Mon, 7 Feb 2022 18:08:42 +0300
Subject: intermediate changes ref:cde9a383711a11544ce7e107a78147fb96cc4029

---
 .../py3/IPython/testing/plugin/test_ipdoctest.py   | 76 ++++++++++++++++++++++
 1 file changed, 76 insertions(+)
 create mode 100644 contrib/python/ipython/py3/IPython/testing/plugin/test_ipdoctest.py

(limited to 'contrib/python/ipython/py3/IPython/testing/plugin/test_ipdoctest.py')

diff --git a/contrib/python/ipython/py3/IPython/testing/plugin/test_ipdoctest.py b/contrib/python/ipython/py3/IPython/testing/plugin/test_ipdoctest.py
new file mode 100644
index 0000000000..d8f5991636
--- /dev/null
+++ b/contrib/python/ipython/py3/IPython/testing/plugin/test_ipdoctest.py
@@ -0,0 +1,76 @@
+"""Tests for the ipdoctest machinery itself.
+
+Note: in a file named test_X, functions whose only test is their docstring (as
+a doctest) and which have no test functionality of their own, should be called
+'doctest_foo' instead of 'test_foo', otherwise they get double-counted (the
+empty function call is counted as a test, which just inflates tests numbers
+artificially).
+"""
+
+def doctest_simple():
+    """ipdoctest must handle simple inputs
+    
+    In [1]: 1
+    Out[1]: 1
+
+    In [2]: print(1)
+    1
+    """
+
+def doctest_multiline1():
+    """The ipdoctest machinery must handle multiline examples gracefully.
+
+    In [2]: for i in range(4):
+       ...:     print(i)
+       ...:      
+    0
+    1
+    2
+    3
+    """
+
+def doctest_multiline2():
+    """Multiline examples that define functions and print output.
+
+    In [7]: def f(x):
+       ...:     return x+1
+       ...: 
+
+    In [8]: f(1)
+    Out[8]: 2
+
+    In [9]: def g(x):
+       ...:     print('x is:',x)
+       ...:      
+
+    In [10]: g(1)
+    x is: 1
+
+    In [11]: g('hello')
+    x is: hello
+    """
+
+
+def doctest_multiline3():
+    """Multiline examples with blank lines.
+
+    In [12]: def h(x):
+       ....:     if x>1:
+       ....:         return x**2
+       ....:     # To leave a blank line in the input, you must mark it
+       ....:     # with a comment character:
+       ....:     #
+       ....:     # otherwise the doctest parser gets confused.
+       ....:     else:
+       ....:         return -1
+       ....:      
+
+    In [13]: h(5)
+    Out[13]: 25
+
+    In [14]: h(1)
+    Out[14]: -1
+
+    In [15]: h(0)
+    Out[15]: -1
+   """
-- 
cgit v1.2.3