()
| 1076 | |
| 1077 | # Simple smoke test, needs to be converted to a proper automatic test. |
| 1078 | def test(): |
| 1079 | |
| 1080 | examples = [ |
| 1081 | r""" |
| 1082 | In [9]: pwd |
| 1083 | Out[9]: '/home/jdhunter/py4science/book' |
| 1084 | |
| 1085 | In [10]: cd bookdata/ |
| 1086 | /home/jdhunter/py4science/book/bookdata |
| 1087 | |
| 1088 | In [2]: from pylab import * |
| 1089 | |
| 1090 | In [2]: ion() |
| 1091 | |
| 1092 | In [3]: im = imread('stinkbug.png') |
| 1093 | |
| 1094 | @savefig mystinkbug.png width=4in |
| 1095 | In [4]: imshow(im) |
| 1096 | Out[4]: <matplotlib.image.AxesImage object at 0x39ea850> |
| 1097 | |
| 1098 | """, |
| 1099 | r""" |
| 1100 | |
| 1101 | In [1]: x = 'hello world' |
| 1102 | |
| 1103 | # string methods can be |
| 1104 | # used to alter the string |
| 1105 | @doctest |
| 1106 | In [2]: x.upper() |
| 1107 | Out[2]: 'HELLO WORLD' |
| 1108 | |
| 1109 | @verbatim |
| 1110 | In [3]: x.st<TAB> |
| 1111 | x.startswith x.strip |
| 1112 | """, |
| 1113 | r""" |
| 1114 | |
| 1115 | In [130]: url = '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' |
| 1117 | |
| 1118 | In [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 | |
| 1121 | In [60]: import urllib |
| 1122 | |
| 1123 | """, |
| 1124 | r"""\ |
| 1125 | |
| 1126 | In [133]: import numpy.random |
| 1127 | |
| 1128 | @suppress |
| 1129 | In [134]: numpy.random.seed(2358) |
| 1130 | |
| 1131 | @doctest |
| 1132 | In [135]: numpy.random.rand(10,2) |
| 1133 | Out[135]: |
| 1134 | array([[ 0.64524308, 0.59943846], |
| 1135 | [ 0.47102322, 0.8715456 ], |
no test coverage detected