##// 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:

r15445:e2d8785a
r20884:3740b498
Show More
test_pandoc.py
70 lines | 2.5 KiB | text/x-python | PythonLexer
Daniel B. Vasquez
nbconvert.utils.pandoc:...
r14766 """Test Pandoc module"""
#-----------------------------------------------------------------------------
Jonathan Frederic
Fixed spacing in pandoc tests
r14823 # Copyright (C) 2014 The IPython Development Team
Daniel B. Vasquez
nbconvert.utils.pandoc:...
r14766 #
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
import os
MinRK
suppress warnings test_pandoc
r15441 import warnings
Daniel B. Vasquez
nbconvert.utils.pandoc:...
r14766
from IPython.testing import decorators as dec
Daniel B. Vasquez
fix test_pandoc imports
r14830 from IPython.nbconvert.tests.base import TestsBase
from .. import pandoc
Daniel B. Vasquez
nbconvert.utils.pandoc:...
r14766
#-----------------------------------------------------------------------------
# Classes and functions
#-----------------------------------------------------------------------------
class TestPandoc(TestsBase):
"""Collection of Pandoc tests"""
def __init__(self, *args, **kwargs):
super(TestPandoc, self).__init__(*args, **kwargs)
self.original_env = os.environ.copy()
@dec.onlyif_cmds_exist('pandoc')
def test_pandoc_available(self):
Daniel B. Vasquez
big cleanup of nbconvert.utils.pandoc module. Remove useless functions, less cached values.
r14768 """ Test behaviour that pandoc functions raise PandocMissing as documented """
pandoc.clean_cache()
Daniel B. Vasquez
nbconvert.utils.pandoc:...
r14766 os.environ["PATH"] = ""
MinRK
suppress warnings test_pandoc
r15441 with self.assertRaises(pandoc.PandocMissing):
pandoc.get_pandoc_version()
with self.assertRaises(pandoc.PandocMissing):
pandoc.check_pandoc_version()
with self.assertRaises(pandoc.PandocMissing):
pandoc.pandoc("", "markdown", "html")
Daniel B. Vasquez
nbconvert.utils.pandoc:...
r14766
Daniel B. Vasquez
big cleanup of nbconvert.utils.pandoc module. Remove useless functions, less cached values.
r14768 # original_env["PATH"] should contain pandoc
Daniel B. Vasquez
nbconvert.utils.pandoc:...
r14766 os.environ["PATH"] = self.original_env["PATH"]
MinRK
catch_warnings(record=True)...
r15445 with warnings.catch_warnings(record=True) as w:
MinRK
suppress warnings test_pandoc
r15441 pandoc.get_pandoc_version()
pandoc.check_pandoc_version()
pandoc.pandoc("", "markdown", "html")
self.assertEqual(w, [])
Daniel B. Vasquez
nbconvert.utils.pandoc:...
r14766
Jonathan Frederic
Fixed spacing in pandoc tests
r14823 @dec.onlyif_cmds_exist('pandoc')
Daniel B. Vasquez
nbconvert.utils.pandoc:...
r14766 def test_minimal_version(self):
Daniel B. Vasquez
big cleanup of nbconvert.utils.pandoc module. Remove useless functions, less cached values.
r14768 original_minversion = pandoc._minimal_version
MinRK
suppress warnings test_pandoc
r15441
Daniel B. Vasquez
big cleanup of nbconvert.utils.pandoc module. Remove useless functions, less cached values.
r14768 pandoc._minimal_version = "120.0"
MinRK
catch_warnings(record=True)...
r15445 with warnings.catch_warnings(record=True) as w:
MinRK
suppress warnings test_pandoc
r15441 assert not pandoc.check_pandoc_version()
self.assertEqual(len(w), 1)
Daniel B. Vasquez
nbconvert.utils.pandoc:...
r14766
Daniel B. Vasquez
big cleanup of nbconvert.utils.pandoc module. Remove useless functions, less cached values.
r14768 pandoc._minimal_version = pandoc.get_pandoc_version()
Daniel B. Vasquez
nbconvert.utils.pandoc:...
r14766 assert pandoc.check_pandoc_version()
Daniel B. Vasquez
big cleanup of nbconvert.utils.pandoc module. Remove useless functions, less cached values.
r14768
def pandoc_function_raised_missing(f, *args, **kwargs):
try:
f(*args, **kwargs)
Daniel B. Vasquez
fix Py3 test compatibility
r14769 except pandoc.PandocMissing:
Daniel B. Vasquez
big cleanup of nbconvert.utils.pandoc module. Remove useless functions, less cached values.
r14768 return True
else:
return False