Added simple ipynb reader/writer tests.

Closes #5274.
This commit is contained in:
John MacFarlane 2019-02-09 14:53:30 -08:00
parent ec11f8d992
commit 1cdbb896f6
5 changed files with 101 additions and 0 deletions

View file

@ -322,6 +322,9 @@ extra-source-files:
test/epub/*.native test/epub/*.native
test/pptx/*.pptx test/pptx/*.pptx
test/pptx/*.native test/pptx/*.native
test/ipynb/*.in.native
test/ipynb/*.out.native
test/ipynb/*.ipynb
test/txt2tags.t2t test/txt2tags.t2t
test/twiki-reader.twiki test/twiki-reader.twiki
test/tikiwiki-reader.tikiwiki test/tikiwiki-reader.tikiwiki

View file

@ -191,6 +191,12 @@ tests pandocPath =
[ test' "reader" ["-r", "org", "-w", "native", "-s"] [ test' "reader" ["-r", "org", "-w", "native", "-s"]
"org-select-tags.org" "org-select-tags.native" "org-select-tags.org" "org-select-tags.native"
] ]
, testGroup "ipynb"
[ test' "reader" ["-f", "ipynb", "-t", "native", "-s"]
"ipynb/simple.ipynb" "ipynb/simple.out.native"
, test' "writer" ["-f", "native", "-t", "ipynb", "-s"]
"ipynb/simple.in.native" "ipynb/simple.ipynb"
]
] ]
where where
test' = test pandocPath test' = test pandocPath

View file

@ -0,0 +1,13 @@
Pandoc (Meta {unMeta = fromList [("jupyter",MetaMap (fromList [("nbformat",MetaInlines [Str "4"]),("nbformat_minor",MetaInlines [Str "5"])]))]})
[Div ("",["cell","markdown"],[])
[Header 1 ("lorem-ipsum",[],[]) [Str "Lorem",Space,Str "ipsum"]
,Para [Strong [Str "Lorem",Space,Str "ipsum"],Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipiscing",Space,Str "elit.",Space,Str "Nunc",Space,Str "luctus",SoftBreak,Str "bibendum",Space,Str "felis",Space,Str "dictum",Space,Str "sodales."]]
,Div ("",["cell","code"],[])
[CodeBlock ("",["python"],[]) "print(\"hello\")"]
,Div ("",["cell","markdown"],[])
[Header 2 ("pyout",[],[]) [Str "Pyout"]]
,Div ("",["cell","code"],[])
[CodeBlock ("",["python"],[]) "from IPython.display import HTML\nHTML(\"\"\"\n<script>\nconsole.log(\"hello\");\n</script>\n<b>HTML</b>\n\"\"\")"]
,Div ("",["cell","markdown"],[])
[Header 2 ("image",[],[]) [Str "Image"]
,Para [Str "This",Space,Str "image",Space,Image ("",[],[]) [Str "the",Space,Str "moon"] ("lalune.jpg",""),Space,Str "will",Space,Str "be",Space,Str "included",Space,Str "as",Space,Str "a",Space,Str "cell",SoftBreak,Str "attachment."]]]

66
test/ipynb/simple.ipynb Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,13 @@
Pandoc (Meta {unMeta = fromList [("jupyter",MetaMap (fromList [("nbformat",MetaString "4"),("nbformat_minor",MetaString "5")]))]})
[Div ("",["cell","markdown"],[])
[Header 1 ("lorem-ipsum",[],[]) [Str "Lorem",Space,Str "ipsum"]
,Para [Strong [Str "Lorem",Space,Str "ipsum"],Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipiscing",Space,Str "elit.",Space,Str "Nunc",Space,Str "luctus",SoftBreak,Str "bibendum",Space,Str "felis",Space,Str "dictum",Space,Str "sodales."]]
,Div ("",["cell","code"],[])
[CodeBlock ("",["python"],[]) "print(\"hello\")"]
,Div ("",["cell","markdown"],[])
[Header 2 ("pyout",[],[]) [Str "Pyout"]]
,Div ("",["cell","code"],[])
[CodeBlock ("",["python"],[]) "from IPython.display import HTML\nHTML(\"\"\"\n<script>\nconsole.log(\"hello\");\n</script>\n<b>HTML</b>\n\"\"\")"]
,Div ("",["cell","markdown"],[])
[Header 2 ("image",[],[]) [Str "Image"]
,Para [Str "This",Space,Str "image",Space,Image ("",[],[]) [Str "the",Space,Str "moon"] ("lalune.jpg",""),Space,Str "will",Space,Str "be",Space,Str "included",Space,Str "as",Space,Str "a",Space,Str "cell",SoftBreak,Str "attachment."]]]