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

Function ranfunc

IPython/testing/plugin/dtexample.py:75–102  ·  view source on GitHub ↗

A function with some random output. Normal examples are verified as usual: >>> 1+3 4 But if you put '# random' in the output, it is ignored: >>> 1+3 junk goes here... # random >>> 1+2 again, anything goes #random if multiline, the r

()

Source from the content-addressed store, hash-verified

73
74
75def ranfunc():
76 """A function with some random output.
77
78 Normal examples are verified as usual:
79 >>> 1+3
80 4
81
82 But if you put '# random' in the output, it is ignored:
83 >>> 1+3
84 junk goes here... # random
85
86 >>> 1+2
87 again, anything goes #random
88 if multiline, the random mark is only needed once.
89
90 >>> 1+2
91 You can also put the random marker at the end:
92 # random
93
94 >>> 1+2
95 # random
96 .. or at the beginning.
97
98 More correct input is properly verified:
99 >>> ranfunc()
100 'ranfunc'
101 """
102 return 'ranfunc'
103
104
105def random_all():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected