aboutsummaryrefslogtreecommitdiff
path: root/test/ipynb/mime.native
diff options
context:
space:
mode:
Diffstat (limited to 'test/ipynb/mime.native')
-rw-r--r--test/ipynb/mime.native154
1 files changed, 154 insertions, 0 deletions
diff --git a/test/ipynb/mime.native b/test/ipynb/mime.native
new file mode 100644
index 000000000..21e3444e2
--- /dev/null
+++ b/test/ipynb/mime.native
@@ -0,0 +1,154 @@
+[ Div
+ ( "0ad1fbe7-107b-4668-ae4d-8ce4ae9a4400"
+ , [ "cell" , "code" ]
+ , [ ( "execution_count" , "1" ) ]
+ )
+ [ CodeBlock
+ ( "" , [ "python" ] , [] )
+ "from __future__ import annotations\n\nfrom dataclasses import dataclass"
+ ]
+, Div
+ ( "c2d3a9f4-dfdb-4ced-bbcd-3dfd1780af80"
+ , [ "cell" , "code" ]
+ , [ ( "execution_count" , "2" ) ]
+ )
+ [ CodeBlock
+ ( "" , [ "python" ] , [] )
+ "import IPython\n\nprint(IPython.__version__)"
+ , Div
+ ( "" , [ "output" , "stream" , "stdout" ] , [] )
+ [ CodeBlock ( "" , [] , [] ) "7.29.0\n" ]
+ ]
+, Div
+ ( "21e7a4a1-0cf8-48cc-823c-dca698ae6853"
+ , [ "cell" , "markdown" ]
+ , []
+ )
+ [ Para
+ [ Str "Supported"
+ , Space
+ , Str "IPython"
+ , Space
+ , Str "display"
+ , Space
+ , Str "formatters:"
+ ]
+ ]
+, Div
+ ( "053cdbc4-b157-4e3e-9c86-8f374770d006"
+ , [ "cell" , "code" ]
+ , [ ( "execution_count" , "3" ) ]
+ )
+ [ CodeBlock
+ ( "" , [ "python" ] , [] )
+ "ip = get_ipython()\nfor mime in ip.display_formatter.formatters:\n print(mime)"
+ , Div
+ ( "" , [ "output" , "stream" , "stdout" ] , [] )
+ [ CodeBlock
+ ( "" , [] , [] )
+ "text/plain\ntext/html\ntext/markdown\nimage/svg+xml\nimage/png\napplication/pdf\nimage/jpeg\ntext/latex\napplication/json\napplication/javascript\n"
+ ]
+ ]
+, Div
+ ( "d79b063d-ce81-497b-a0ea-5b2e2972e845"
+ , [ "cell" , "markdown" ]
+ , []
+ )
+ [ Para
+ [ Str "Let's"
+ , Space
+ , Str "write"
+ , Space
+ , Str "a"
+ , Space
+ , Str "simple"
+ , Space
+ , Str "class"
+ , Space
+ , Str "that"
+ , Space
+ , Str "will"
+ , Space
+ , Str "output"
+ , Space
+ , Str "different"
+ , Space
+ , Str "mime:"
+ ]
+ ]
+, Div
+ ( "c847636c-1c45-432e-9d8d-7310dd7f5637"
+ , [ "cell" , "code" ]
+ , [ ( "execution_count" , "4" ) ]
+ )
+ [ CodeBlock
+ ( "" , [ "python" ] , [] )
+ "@dataclass\nclass Mime:\n math: str\n\n def _repr_mimebundle_(\n self,\n include: Container[str] | None = None,\n exclude: Container[str] | None = None,\n **kwargs,\n ) -> dict[str, str]:\n string = self.math\n data = {\n \"text/plain\": string,\n \"text/html\": (latex := f\"\\\\[{string}\\\\]\"),\n \"text/markdown\": f\"$${string}$$\",\n # \"image/svg+xml\":,\n # \"image/png\":,\n # \"application/pdf\":,\n # \"image/jpeg\":,\n \"text/latex\": latex,\n # \"application/json\":,\n # \"application/javascript\":,\n }\n if include:\n data = {k: v for k, v in data.items() if k in include}\n if exclude:\n data = {k: v for k, v in data.items() if k not in exclude}\n return data"
+ ]
+, Div
+ ( "4fa54f22-0c3a-4809-91f7-ea7101ff1907"
+ , [ "cell" , "code" ]
+ , [ ( "execution_count" , "5" ) ]
+ )
+ [ CodeBlock
+ ( "" , [ "python" ] , [] ) "mime = Mime(\"E = mc^2\")"
+ ]
+, Div
+ ( "c419e6a6-240c-4af0-a244-5f1526705c30"
+ , [ "cell" , "code" ]
+ , [ ( "execution_count" , "6" ) ]
+ )
+ [ CodeBlock ( "" , [ "python" ] , [] ) "mime"
+ , Div
+ ( ""
+ , [ "output" , "execute_result" ]
+ , [ ( "execution_count" , "6" ) ]
+ )
+ [ RawBlock (Format "html") "\\[E = mc^2\\]"
+ , RawBlock (Format "latex") "\\[E = mc^2\\]"
+ , RawBlock (Format "markdown") "$$E = mc^2$$"
+ , CodeBlock ( "" , [] , [] ) "E = mc^2"
+ ]
+ ]
+, Div
+ ( "bf140b8e-16ac-4670-9778-f1c1d9486f9d"
+ , [ "cell" , "markdown" ]
+ , []
+ )
+ [ Para
+ [ Str "Note"
+ , Space
+ , Str "that"
+ , Space
+ , Str "#7561"
+ , Space
+ , Str "made"
+ , Space
+ , Str "ipynb"
+ , Space
+ , Str "reader"
+ , Space
+ , Str "aware"
+ , Space
+ , Str "of"
+ , Space
+ , Str "this,"
+ , Space
+ , Str "and"
+ , Space
+ , Str "#7563"
+ , Space
+ , Str "made"
+ , Space
+ , Str "ipynb"
+ , Space
+ , Str "writer"
+ , Space
+ , Str "aware"
+ , Space
+ , Str "of"
+ , Space
+ , Str "this."
+ ]
+ ]
+]