##// END OF EJS Templates
Backport PR #8131: handle undefined when sorting quick help...
Backport PR #8131: handle undefined when sorting quick help Since undefined is neither less than nor greater than anything in Javascript, the sort function was treating it as equal to everything, causing inconsistent behavior depending on the sort algorithm of the browser. closes #8089 This ensures undefined elements are sorted last in the sequence.

File last commit:

r18605:9867311c
r20884:3740b498
Show More
base.py
41 lines | 1.5 KiB | text/x-python | PythonLexer
"""utility functions for preprocessor tests"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from IPython.nbformat import v4 as nbformat
from ...tests.base import TestsBase
from ...exporters.exporter import ResourcesDict
class PreprocessorTestsBase(TestsBase):
"""Contains test functions preprocessor tests"""
def build_notebook(self):
"""Build a notebook in memory for use with preprocessor tests"""
outputs = [
nbformat.new_output("stream", name="stdout", text="a"),
nbformat.new_output("display_data", data={'text/plain': 'b'}),
nbformat.new_output("stream", name="stdout", text="c"),
nbformat.new_output("stream", name="stdout", text="d"),
nbformat.new_output("stream", name="stderr", text="e"),
nbformat.new_output("stream", name="stderr", text="f"),
nbformat.new_output("display_data", data={'image/png': 'Zw=='}), # g
nbformat.new_output("display_data", data={'application/pdf': 'aA=='}), # h
]
cells=[nbformat.new_code_cell(source="$ e $", execution_count=1, outputs=outputs),
nbformat.new_markdown_cell(source="$ e $")]
return nbformat.new_notebook(cells=cells)
def build_resources(self):
"""Build an empty resources dictionary."""
res = ResourcesDict()
res['metadata'] = ResourcesDict()
return res