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

Function ipfunc

IPython/testing/plugin/dtexample.py:26–72  ·  view source on GitHub ↗

Some ipython tests... In [1]: import os In [3]: 2+3 Out[3]: 5 In [26]: for i in range(3): ....: print(i, end=' ') ....: print(i+1, end=' ') ....: 0 1 1 2 2 3 Examples that access the operating system work: In [1]: !echo hello hello

()

Source from the content-addressed store, hash-verified

24 return 'pyfunc'
25
26def ipfunc():
27 """Some ipython tests...
28
29 In [1]: import os
30
31 In [3]: 2+3
32 Out[3]: 5
33
34 In [26]: for i in range(3):
35 ....: print(i, end=' ')
36 ....: print(i+1, end=' ')
37 ....:
38 0 1 1 2 2 3
39
40
41 Examples that access the operating system work:
42
43 In [1]: !echo hello
44 hello
45
46 In [2]: !echo hello > /tmp/foo_iptest
47
48 In [3]: !cat /tmp/foo_iptest
49 hello
50
51 In [4]: rm -f /tmp/foo_iptest
52
53 It's OK to use '_' for the last result, but do NOT try to use IPython's
54 numbered history of _NN outputs, since those won't exist under the
55 doctest environment:
56
57 In [7]: 'hi'
58 Out[7]: 'hi'
59
60 In [8]: print(repr(_))
61 'hi'
62
63 In [7]: 3+4
64 Out[7]: 7
65
66 In [8]: _+3
67 Out[8]: 10
68
69 In [9]: ipfunc()
70 Out[9]: 'ipfunc'
71 """
72 return 'ipfunc'
73
74
75def ranfunc():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected