Skip to content

Commit ee2e720

Browse files
committed
Add nbconvert test
1 parent 97b61ce commit ee2e720

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

tests/data/notebook.ipynb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"cells": [
3+
{
4+
"metadata": {
5+
"trusted": true
6+
},
7+
"cell_type": "code",
8+
"source": "x=999\nprint(x)",
9+
"execution_count": null,
10+
"outputs": []
11+
}
12+
],
13+
"metadata":{
14+
"language_info":{
15+
"codemirror_mode":{
16+
"name":"ipython",
17+
"version":3
18+
},
19+
"file_extension":".py",
20+
"mimetype":"text/x-python",
21+
"name":"python",
22+
"nbconvert_exporter":"python",
23+
"pygments_lexer":"ipython3",
24+
"version":"3.7.6"
25+
}
26+
},
27+
"nbformat":4,
28+
"nbformat_minor":4
29+
}

tests/test_jupyter_nbconvert.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import unittest
2+
3+
import subprocess
4+
5+
class TestJupyterNbconvert(unittest.TestCase):
6+
def test_nbconvert(self):
7+
result = subprocess.run([
8+
'jupyter',
9+
'nbconvert',
10+
'--to',
11+
'notebook',
12+
'--template',
13+
'/opt/kaggle/nbconvert-extensions.tpl',
14+
'--execute',
15+
'--stdout',
16+
'/input/tests/data/notebook.ipynb',
17+
], stdout=subprocess.PIPE)
18+
19+
self.assertEqual(0, result.returncode)
20+
self.assertTrue(b'999' in result.stdout)

0 commit comments

Comments
 (0)