##// END OF EJS Templates
python3 syntax fixes on various scripts...
python3 syntax fixes on various scripts revealed by running tools/build_relese

File last commit:

r16114:15cc5a8e
r20277:6ceb4492
Show More
Test Output Callbacks.ipynb
268 lines | 4.7 KiB | text/plain | TextLexer
/ tools / tests / Test Output Callbacks.ipynb
MinRK
add output callbacks test notebook...
r13209 {
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Basic Output"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from IPython.display import display"
],
"language": "python",
"metadata": {},
MinRK
test clear_output callback
r13215 "outputs": []
MinRK
add output callbacks test notebook...
r13209 },
{
"cell_type": "code",
"collapsed": false,
"input": [
Thomas Kluyver
Polish test notebook
r13996 "print('hi')"
MinRK
add output callbacks test notebook...
r13209 ],
"language": "python",
"metadata": {},
MinRK
test clear_output callback
r13215 "outputs": []
MinRK
add output callbacks test notebook...
r13209 },
{
"cell_type": "code",
"collapsed": false,
"input": [
"display('hi')"
],
"language": "python",
"metadata": {},
MinRK
test clear_output callback
r13215 "outputs": []
MinRK
add output callbacks test notebook...
r13209 },
{
"cell_type": "code",
"collapsed": false,
"input": [
"1"
],
"language": "python",
"metadata": {},
MinRK
test clear_output callback
r13215 "outputs": []
MinRK
add output callbacks test notebook...
r13209 },
{
"cell_type": "code",
"collapsed": false,
"input": [
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"plt.plot([1,3,2])"
],
"language": "python",
"metadata": {},
MinRK
test clear_output callback
r13215 "outputs": []
MinRK
add output callbacks test notebook...
r13209 },
{
"cell_type": "code",
"collapsed": false,
"input": [
"%%javascript\n",
"console.log(\"I ran!\");"
],
"language": "python",
"metadata": {},
MinRK
test clear_output callback
r13215 "outputs": []
MinRK
add output callbacks test notebook...
r13209 },
{
"cell_type": "code",
"collapsed": false,
"input": [
"%%html\n",
"<b>bold</b>"
],
"language": "python",
"metadata": {},
MinRK
test clear_output callback
r13215 "outputs": []
MinRK
add output callbacks test notebook...
r13209 },
{
"cell_type": "code",
"collapsed": false,
"input": [
"%%latex\n",
"$$\n",
"a = 5\n",
"$$"
],
"language": "python",
"metadata": {},
MinRK
test clear_output callback
r13215 "outputs": []
MinRK
add output callbacks test notebook...
r13209 },
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"input_request"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"raw_input(\"prompt > \")"
],
"language": "python",
"metadata": {},
MinRK
test clear_output callback
r13215 "outputs": []
MinRK
add output callbacks test notebook...
r13209 },
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"set_next_input"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%%writefile tst.py\n",
"def foo():\n",
" pass\n"
],
"language": "python",
"metadata": {},
MinRK
test clear_output callback
r13215 "outputs": []
MinRK
add output callbacks test notebook...
r13209 },
{
"cell_type": "code",
"collapsed": false,
"input": [
"%load tst.py"
],
"language": "python",
"metadata": {},
MinRK
test clear_output callback
r13215 "outputs": []
MinRK
add output callbacks test notebook...
r13209 },
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Pager in execute_reply"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"plt?"
],
"language": "python",
"metadata": {},
MinRK
test clear_output callback
r13215 "outputs": []
MinRK
add output callbacks test notebook...
r13209 },
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"object_info"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
Thomas Kluyver
Polish test notebook
r13996 "# press shift-tab after parentheses\n",
MinRK
add output callbacks test notebook...
r13209 "int("
],
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"complete"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
Thomas Kluyver
Polish test notebook
r13996 "# press tab after f\n",
MinRK
add output callbacks test notebook...
r13209 "f"
],
"language": "python",
"metadata": {},
"outputs": []
MinRK
test clear_output callback
r13215 },
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"clear_output"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
Thomas Kluyver
Polish test notebook
r13996 "import sys, time\n",
MinRK
test clear_output callback
r13215 "from IPython.display import clear_output"
],
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"for i in range(10):\n",
" clear_output()\n",
" time.sleep(0.25)\n",
Thomas Kluyver
Polish test notebook
r13996 " print(i)\n",
MinRK
test clear_output callback
r13215 " sys.stdout.flush()\n",
" time.sleep(0.25)\n"
],
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"for i in range(10):\n",
" clear_output(wait=True)\n",
" time.sleep(0.25)\n",
Thomas Kluyver
Polish test notebook
r13996 " print(i)\n",
MinRK
test clear_output callback
r13215 " sys.stdout.flush()\n"
],
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
MinRK
add output callbacks test notebook...
r13209 }
],
"metadata": {}
}
]
}