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

Function test

IPython/sphinxext/ipython_directive.py:1078–1244  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1076
1077# Simple smoke test, needs to be converted to a proper automatic test.
1078def test():
1079
1080 examples = [
1081 r"""
1082In [9]: pwd
1083Out[9]: '/home/jdhunter/py4science/book'
1084
1085In [10]: cd bookdata/
1086/home/jdhunter/py4science/book/bookdata
1087
1088In [2]: from pylab import *
1089
1090In [2]: ion()
1091
1092In [3]: im = imread('stinkbug.png')
1093
1094@savefig mystinkbug.png width=4in
1095In [4]: imshow(im)
1096Out[4]: <matplotlib.image.AxesImage object at 0x39ea850>
1097
1098""",
1099 r"""
1100
1101In [1]: x = 'hello world'
1102
1103# string methods can be
1104# used to alter the string
1105@doctest
1106In [2]: x.upper()
1107Out[2]: 'HELLO WORLD'
1108
1109@verbatim
1110In [3]: x.st<TAB>
1111x.startswith x.strip
1112""",
1113 r"""
1114
1115In [130]: url = &#x27;http://ichart.finance.yahoo.com/table.csv?s=CROX\
1116 .....: &d=9&e=22&f=2009&g=d&a=1&br=8&c=2006&ignore=.csv&#x27;
1117
1118In [131]: print url.split('&')
1119['http://ichart.finance.yahoo.com/table.csv?s=CROX', 'd=9', 'e=22', 'f=2009', 'g=d', 'a=1', 'b=8', 'c=2006', 'ignore=.csv']
1120
1121In [60]: import urllib
1122
1123""",
1124 r"""\
1125
1126In [133]: import numpy.random
1127
1128@suppress
1129In [134]: numpy.random.seed(2358)
1130
1131@doctest
1132In [135]: numpy.random.rand(10,2)
1133Out[135]:
1134array([[ 0.64524308, 0.59943846],
1135 [ 0.47102322, 0.8715456 ],

Callers 1

Calls 1

IPythonDirectiveClass · 0.85

Tested by

no test coverage detected