docs(test): add jupyter notebook render smoke test
This commit is contained in:
117
demo-notebook.ipynb
Normal file
117
demo-notebook.ipynb
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"# Trade T1 Notebook Smoke Test\n",
|
||||||
|
"\n",
|
||||||
|
"This notebook checks `Jupyter` rendering in Gitea.\n",
|
||||||
|
"\n",
|
||||||
|
"Inline math: $e^{i\\\\pi} + 1 = 0$.\n",
|
||||||
|
"\n",
|
||||||
|
"Display math:\n",
|
||||||
|
"\n",
|
||||||
|
"$$\n",
|
||||||
|
"\\\\sigma(x) = \\\\frac{1}{1 + e^{-x}}\n",
|
||||||
|
"$$\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 1,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"peak amplitude: 1.0000\\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"image/svg+xml": [
|
||||||
|
"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"640\" height=\"320\" viewBox=\"0 0 640 320\">\n",
|
||||||
|
" <rect width=\"640\" height=\"320\" fill=\"#ffffff\"/>\n",
|
||||||
|
" <rect x=\"60\" y=\"30\" width=\"540\" height=\"230\" fill=\"#fbfdff\" stroke=\"#d7e1ea\"/>\n",
|
||||||
|
" <line x1=\"60\" y1=\"260\" x2=\"600\" y2=\"260\" stroke=\"#475569\" stroke-width=\"2\"/>\n",
|
||||||
|
" <line x1=\"60\" y1=\"145\" x2=\"600\" y2=\"145\" stroke=\"#cbd5e1\" stroke-width=\"1\" stroke-dasharray=\"4 4\"/>\n",
|
||||||
|
" <line x1=\"120\" y1=\"30\" x2=\"120\" y2=\"260\" stroke=\"#e2e8f0\" stroke-width=\"1\"/>\n",
|
||||||
|
" <line x1=\"240\" y1=\"30\" x2=\"240\" y2=\"260\" stroke=\"#e2e8f0\" stroke-width=\"1\"/>\n",
|
||||||
|
" <line x1=\"360\" y1=\"30\" x2=\"360\" y2=\"260\" stroke=\"#e2e8f0\" stroke-width=\"1\"/>\n",
|
||||||
|
" <line x1=\"480\" y1=\"30\" x2=\"480\" y2=\"260\" stroke=\"#e2e8f0\" stroke-width=\"1\"/>\n",
|
||||||
|
" <line x1=\"60\" y1=\"70\" x2=\"600\" y2=\"70\" stroke=\"#e2e8f0\" stroke-width=\"1\"/>\n",
|
||||||
|
" <line x1=\"60\" y1=\"220\" x2=\"600\" y2=\"220\" stroke=\"#e2e8f0\" stroke-width=\"1\"/>\n",
|
||||||
|
" <polyline fill=\"none\" stroke=\"#2563eb\" stroke-width=\"4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" points=\"60,145 90,109 120,78 150,54 180,38 210,33 240,40 270,58 300,86 330,120 360,155 390,191 420,221 450,242 480,254 510,253 540,241 570,218 600,185\"/>\n",
|
||||||
|
" <circle cx=\"60\" cy=\"145\" r=\"5\" fill=\"#ef4444\"/>\n",
|
||||||
|
" <circle cx=\"240\" cy=\"40\" r=\"5\" fill=\"#ef4444\"/>\n",
|
||||||
|
" <circle cx=\"420\" cy=\"221\" r=\"5\" fill=\"#ef4444\"/>\n",
|
||||||
|
" <circle cx=\"600\" cy=\"185\" r=\"5\" fill=\"#ef4444\"/>\n",
|
||||||
|
" <text x=\"70\" y=\"22\" font-family=\"DejaVu Sans, Arial, sans-serif\" font-size=\"18\" fill=\"#0f172a\">matplotlib sine wave demo</text>\n",
|
||||||
|
" <text x=\"602\" y=\"266\" font-family=\"DejaVu Sans, Arial, sans-serif\" font-size=\"12\" fill=\"#334155\">x</text>\n",
|
||||||
|
" <text x=\"36\" y=\"38\" font-family=\"DejaVu Sans, Arial, sans-serif\" font-size=\"12\" fill=\"#334155\">y</text>\n",
|
||||||
|
" <text x=\"62\" y=\"284\" font-family=\"DejaVu Sans, Arial, sans-serif\" font-size=\"12\" fill=\"#475569\">0</text>\n",
|
||||||
|
" <text x=\"233\" y=\"284\" font-family=\"DejaVu Sans, Arial, sans-serif\" font-size=\"12\" fill=\"#475569\">π</text>\n",
|
||||||
|
" <text x=\"412\" y=\"284\" font-family=\"DejaVu Sans, Arial, sans-serif\" font-size=\"12\" fill=\"#475569\">2π</text>\n",
|
||||||
|
" <text x=\"70\" y=\"84\" font-family=\"DejaVu Sans, Arial, sans-serif\" font-size=\"12\" fill=\"#475569\">1.0</text>\n",
|
||||||
|
" <text x=\"70\" y=\"236\" font-family=\"DejaVu Sans, Arial, sans-serif\" font-size=\"12\" fill=\"#475569\">-1.0</text>\n",
|
||||||
|
"</svg>\n"
|
||||||
|
],
|
||||||
|
"text/plain": [
|
||||||
|
"<Figure size 600x300 with 1 Axes>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "display_data"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import numpy as np\\n",
|
||||||
|
"import matplotlib.pyplot as plt\\n",
|
||||||
|
"\\n",
|
||||||
|
"x = np.linspace(0, 2 * np.pi, 200)\\n",
|
||||||
|
"y = np.sin(x)\\n",
|
||||||
|
"\\n",
|
||||||
|
"fig, ax = plt.subplots(figsize=(6, 3))\\n",
|
||||||
|
"ax.plot(x, y, color='tab:blue', linewidth=2, label='sin(x)')\\n",
|
||||||
|
"ax.scatter([0, np.pi, 2 * np.pi], [0, 0, 0], color='tab:red', zorder=3)\\n",
|
||||||
|
"ax.set_title('matplotlib sine wave demo')\\n",
|
||||||
|
"ax.set_xlabel('x')\\n",
|
||||||
|
"ax.set_ylabel('y')\\n",
|
||||||
|
"ax.grid(True, alpha=0.25)\\n",
|
||||||
|
"ax.legend()\\n",
|
||||||
|
"print(f'peak amplitude: {y.max():.4f}')\\n",
|
||||||
|
"plt.show()\\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"Rendered SVG output above is embedded in the notebook, so Gitea can display it without executing Python on the server.\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "Python 3",
|
||||||
|
"language": "python",
|
||||||
|
"name": "python3"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"codemirror_mode": {
|
||||||
|
"name": "ipython",
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"file_extension": ".py",
|
||||||
|
"mimetype": "text/x-python",
|
||||||
|
"name": "python",
|
||||||
|
"nbconvert_exporter": "python",
|
||||||
|
"pygments_lexer": "ipython3",
|
||||||
|
"version": "3.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 5
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user