##// END OF EJS Templates
Merge pull request #6828 from takluyver/terminal-list...
Merge pull request #6828 from takluyver/terminal-list Add terminals tab to the dashboard

File last commit:

r15386:5ee6cfdf
r18615:96791286 merge
Show More
base.py
56 lines | 2.3 KiB | text/x-python | PythonLexer
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023 """
Paul Ivanov
replace 'transformer' with 'preprocessor'
r12219 Module with utility functions for preprocessor tests
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023 """
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
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 #-----------------------------------------------------------------------------
# Class
#-----------------------------------------------------------------------------
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
outputs = [nbformat.new_output(output_type="stream", stream="stdout", output_text="a"),
nbformat.new_output(output_type="text", output_text="b"),
nbformat.new_output(output_type="stream", stream="stdout", output_text="c"),
nbformat.new_output(output_type="stream", stream="stdout", output_text="d"),
nbformat.new_output(output_type="stream", stream="stderr", output_text="e"),
Jonathan Frederic
Added png output
r12027 nbformat.new_output(output_type="stream", stream="stderr", output_text="f"),
MinRK
add pdf to extract output tests
r15386 nbformat.new_output(output_type="png", output_png='Zw==')] # g
out = nbformat.new_output(output_type="application/pdf")
out['application/pdf'] = 'aA==' # h
outputs.append(out)
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023
Jonathan Frederic
Added latex transformer test
r12030 cells=[nbformat.new_code_cell(input="$ e $", prompt_number=1,outputs=outputs),
nbformat.new_text_cell('markdown', source="$ e $")]
MinRK
add pdf to extract output tests
r15386 worksheets = [nbformat.new_worksheet(cells=cells)]
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023
return nbformat.new_notebook(name="notebook1", worksheets=worksheets)
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