##// END OF EJS Templates
strip transient values to/from nb files...
strip transient values to/from nb files orig_nbformat isn’t part of the file format

File last commit:

r18580:ba8461eb
r18581:395fdae2
Show More
base.py
41 lines | 1.6 KiB | text/x-python | PythonLexer
MinRK
update nbconvert to nbformat 4
r18580 """utility functions for preprocessor tests"""
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023
MinRK
update nbconvert to nbformat 4
r18580 # Copyright (c) IPython Development Team.
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023 # Distributed under the terms of the Modified BSD License.
from IPython.nbformat import current as nbformat
Jonathan Frederic
Added utility function to build a proper resources dict
r12031 from ...tests.base import TestsBase
from ...exporters.exporter import ResourcesDict
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023
Paul Ivanov
replace 'transformer' with 'preprocessor'
r12219 class PreprocessorTestsBase(TestsBase):
"""Contains test functions preprocessor tests"""
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023
def build_notebook(self):
Paul Ivanov
replace 'transformer' with 'preprocessor'
r12219 """Build a notebook in memory for use with preprocessor tests"""
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023
MinRK
update nbconvert to nbformat 4
r18580 outputs = [nbformat.new_output(output_type="stream", name="stdout", text="a"),
nbformat.new_output(output_type="display_data", mime_bundle={'text/plain': 'b'}),
nbformat.new_output(output_type="stream", name="stdout", text="c"),
nbformat.new_output(output_type="stream", name="stdout", text="d"),
nbformat.new_output(output_type="stream", name="stderr", text="e"),
nbformat.new_output(output_type="stream", name="stderr", text="f"),
nbformat.new_output(output_type="display_data", mime_bundle={'image/png': 'Zw=='})] # g
out = nbformat.new_output(output_type="display_data")
out['application/pdf'] = 'aA=='
MinRK
add pdf to extract output tests
r15386 outputs.append(out)
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023
MinRK
update nbconvert to nbformat 4
r18580 cells=[nbformat.new_code_cell(source="$ e $", prompt_number=1, outputs=outputs),
nbformat.new_markdown_cell(source="$ e $")]
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023
MinRK
update nbconvert to nbformat 4
r18580 return nbformat.new_notebook(cells=cells)
Jonathan Frederic
Added utility function to build a proper resources dict
r12031
def build_resources(self):
"""Build an empty resources dictionary."""
res = ResourcesDict()
res['metadata'] = ResourcesDict()
Paul Ivanov
replace 'transformer' with 'preprocessor'
r12219 return res