MCPcopy Create free account
hub / github.com/ipython/ipython / doctest_autocall

Function doctest_autocall

IPython/core/tests/test_autocall.py:11–59  ·  view source on GitHub ↗

In [1]: def f1(a,b,c): ...: return a+b+c ...: In [2]: def f2(a): ...: return a + a ...: In [3]: def r(x): ...: return True ...: In [4]: ;f2 a b c Out[4]: 'a b ca b c' In [5]: assert _ == "a b ca b c" In [6]: ,f1

()

Source from the content-addressed store, hash-verified

9from IPython.core.prefilter import AutocallChecker
10
11def doctest_autocall():
12 """
13 In [1]: def f1(a,b,c):
14 ...: return a+b+c
15 ...:
16
17 In [2]: def f2(a):
18 ...: return a + a
19 ...:
20
21 In [3]: def r(x):
22 ...: return True
23 ...:
24
25 In [4]: ;f2 a b c
26 Out[4]: 'a b ca b c'
27
28 In [5]: assert _ == "a b ca b c"
29
30 In [6]: ,f1 a b c
31 Out[6]: 'abc'
32
33 In [7]: assert _ == 'abc'
34
35 In [8]: print(_)
36 abc
37
38 In [9]: /f1 1,2,3
39 Out[9]: 6
40
41 In [10]: assert _ == 6
42
43 In [11]: /f2 4
44 Out[11]: 8
45
46 In [12]: assert _ == 8
47
48 In [12]: del f1, f2
49
50 In [13]: ,r a
51 Out[13]: True
52
53 In [14]: assert _ == True
54
55 In [15]: r'a'
56 Out[15]: 'a'
57
58 In [16]: assert _ == 'a'
59 """
60
61
62def test_autocall_should_ignore_raw_strings():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected