Extract output preprocessor only extracts specified formats

This commit is contained in:
Thomas Kluyver 2013-12-19 17:14:24 -08:00
parent be6a5d32ea
commit 147f33118e

View File

@ -1,4 +1,5 @@
# coding: utf-8
import base64
import io
import json
import os
@ -37,6 +38,10 @@ class NbconvertAPI(object):
def list_formats(self):
return self._req('GET', '')
png_green_pixel = base64.encodestring(b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00'
b'\x00\x00\x01\x00\x00x00\x01\x08\x02\x00\x00\x00\x90wS\xde\x00\x00\x00\x0cIDAT'
b'\x08\xd7c\x90\xfb\xcf\x00\x00\x02\\\x01\x1e.~d\x87\x00\x00\x00\x00IEND\xaeB`\x82')
class APITest(NotebookTestBase):
def setUp(self):
nbdir = self.notebook_dir.name
@ -51,6 +56,7 @@ class APITest(NotebookTestBase):
ws.cells.append(new_heading_cell(u'Created by test ³'))
cc1 = new_code_cell(input=u'print(2*6)')
cc1.outputs.append(new_output(output_text=u'12'))
cc1.outputs.append(new_output(output_png=png_green_pixel, output_type='pyout'))
ws.cells.append(cc1)
with io.open(pjoin(nbdir, 'foo', 'testnb.ipynb'), 'w',