forked from kirbs-/hide_code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_hide_code.py
More file actions
25 lines (19 loc) · 803 Bytes
/
Copy pathtest_hide_code.py
File metadata and controls
25 lines (19 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import nbformat
from hide_code import HideCodeHTMLExporter
from nose.tools import *
from nbconvert import HTMLExporter
class TestHideCode(object):
def test_html_exporter(self):
with open('hide_code_test_notebook.ipynb') as f:
nb = nbformat.reads(f.read(), as_version=4)
exporter = HideCodeHTMLExporter()
output_html, resources = exporter.from_notebook_node(nb)
with open('test.html', 'w') as f:
f.write(output_html)
assert_true(output_html)
def test_nbconvert_html_exporter(self):
with open('hide_code_test_notebook.ipynb') as f:
nb = nbformat.reads(f.read(), as_version=4)
exporter = HTMLExporter()
output_html, resources = exporter.from_notebook_node(nb)
assert_true(output_html)